importtorchfromtransformersimportBloomTokenizerFast,BloomForCausalLMdevice='cuda'iftorch.cuda.is_available()else'cpu'ckpt='mrm8488/bloom-560m-finetuned-sd-prompts'tokenizer=BloomTokenizerFast.from_pretrained(ckpt)model=BloomForCausalLM.from_pretrained(ckpt).to(device)defgenerate_prompt(text):inputs=tokenizer(text,return_tensors='pt')input_ids=inputs.input_ids.to(device)attention_mask=inputs.attention_mask.to(device)output=model.generate(input_ids,attention_mask=attention_mask,repetition_penalty=1.05,max_length=2048,eos_token_id=tokenizer.eos_token_id)returntokenizer.decode(output[0],skip_special_tokens=False)text="<s>Prompt: pikachu dinning in the eiffel tower"generate_prompt(text)# Output: <s>Prompt: pikachu dinning in the eiffel tower, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha</s>
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
learning_rate: 5e-05
train_batch_size: 1
eval_batch_size: 1
seed: 42
gradient_accumulation_steps: 4
total_train_batch_size: 4
optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08