Downloads · 30 days
864
1% of all-time downloads
FredZhang7/anime-anything-promptgen-v2
anime-anything-promptgen-v2 is a text generation model from FredZhang7. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as creativeml-openrail-m.
This model was trained on a dataset of 80,000 safe anime prompts for 3 epochs. I fetched the prompts from the Safebooru API endpoint, but only accepted unique prompts with upscore ≥ 8 and without any blacklisted tags.…
Downloads · 30 days
864
1% of all-time downloads
All-time downloads
116K
Public
Parameters
88.2M
1 GB on disk
Likes
63
Public
Click a slice to open those files.
.bin334 MB · 49%
How the weights are stored.
F3281.9M · 93%
From the Hugging Face model README
This model was trained on a dataset of 80,000 safe anime prompts for 3 epochs. I fetched the prompts from the Safebooru API endpoint, but only accepted unique prompts with up_score ≥ 8 and without any blacklisted tags. I didn't release the V1 model because it often generated gibberish prompts. After trying all means to correct that behavior, I eventually figured that the cause of the gibberish prompts is not from the pipeline params, model structure or training duration, but rather from the random usernames in the training data. Here's the complete prompt preprocessing algorithm.
Prefix 1girl | Generated 1girl prompts | Model Anything V4

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

pip install --upgrade transformers
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'
# generate text using fine-tuned model
nlp = pipeline('text-generation', model=model, tokenizer=tokenizer)
# generate 10 samples using contrastive search
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)):
# remove trailing commas and double spaces
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.
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.
I also use 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.