๐ Fast Anime PromptGen
This model offers a solution to generate high - quality anime prompts. It is trained on a specific dataset, aiming to generate unique and meaningful anime - related text prompts.
โจ Features
- Trained on a dataset of 80,000 safe anime prompts for 3 epochs.
- Fetched prompts from the Safebooru API endpoint with strict filtering.
- Overcame the issue of generating gibberish prompts by identifying the root cause in the training data.
๐ฆ Installation
pip install --upgrade transformers
๐ป Usage Examples
Basic Usage
This model can generate various anime - related prompts. Here are some text - to - image examples:
Prefix 1girl
Prefix 1girlโ|โGenerated 1girl promptsโ|โModel Anything V4

Prefix 1boy
Prefix 1boyโ |โGenerated 1boy promptsโ|โModel Anything V4

Advanced Usage
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel, pipeline
tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
tokenizer.add_special_tokens({'pad_token': '[PAD]'})
model = GPT2LMHeadModel.from_pretrained('FredZhang7/anime-anything-promptgen-v2')
prompt = r'1girl, genshin'
nlp = pipeline('text - generation', model = model, tokenizer = tokenizer)
outs = nlp(prompt, max_length = 76, num_return_sequences = 10, do_sample = True, repetition_penalty = 1.2, temperature = 0.7, top_k = 4, early_stopping = True)
print('\nInput:\n' + 100 * '-')
print('\033[96m' + prompt + '\033[0m')
print('\nOutput:\n' + 100 * '-')
for i in range(len(outs)):
outs[i] = str(outs[i]['generated_text']).replace(' ', '').rstrip(',')
print('\033[92m' + '\n\n'.join(outs) + '\033[0m\n')
Output Example:

Please see Fast GPT PromptGen for more info on the pipeline parameters.
๐ Documentation
This model was trained on a dataset of 80,000 safe anime prompts for 3 epochs. The prompts were fetched from the Safebooru API endpoint, with only unique prompts having up_score โฅ 8 and without any blacklisted tags being accepted.
The V1 model was not released as it often generated gibberish prompts. After extensive troubleshooting, it was found that the cause of the gibberish prompts was the random usernames in the training data.
Here's the complete prompt preprocessing algorithm.
๐ก Usage Tip
๐ก Usage Tip
- If you feel like a generated anime character doesn't show emotions, try emoticons like
;o
, :o
, ;p
, :d
, :p
, and ;d
in the prompt. You can also use phrases like happy smirk
, happy smile
, laughing closed eyes
, etc. to make the characters more lively and expressive.
- Adding
absurdres
instead of highres
and masterpiece
to a prompt can drastically increase the sharpness and resolution of a generated image.
๐ License
- License: creativeml - openrail - m
Other Information
- Tags: stable - diffusion, anime, anything - v4, art, arxiv:2210.14140
- Datasets: FredZhang7/anime - prompts - 180K
- [Link to the Danbooru version](https://huggingface.co/FredZhang7/danbooru - tag - generator)