--- license: apache-2.0 datasets: - Falah/stable_diffusion_prompts_dataset language: - en metrics: - accuracy library_name: diffusers pipeline_tag: text-generation tags: - art - stable diffusion - gpt2 --- # Stable Diffusion Prompts Generation Model This model is designed for generating illustration art style prompts for the Stable Diffusion tool for text-to-image generation. It utilizes the custom dataset "Falah/stable_diffusion_prompts_dataset" to generate creative and coherent text prompts. ## Examples To load the model and generate inferences using the model, you can use the following code snippet: ```python import torch from transformers import AutoTokenizer, AutoModelForCausalLM model_name = "Falah/stable_diffusion_prompts_gen" dataset_name = "Falah/stable_diffusion_prompts_dataset" prompt = r'a beautiful female' # the beginning of the prompt temperature = 0.9 # A higher temperature will produce more diverse results, but with a higher risk of less coherent text top_k = 8 # the number of tokens to sample from at each step max_length = 200 # the maximum number of tokens for the output of the model repetition_penalty = 1.2 # the penalty value for each repetition of a token num_return_sequences = 5 # the number of results to generate tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) input_ids = tokenizer(prompt, return_tensors='pt').input_ids output = model.generate( input_ids, do_sample=True, temperature=temperature, top_k=top_k, max_length=max_length, num_return_sequences=num_return_sequences, repetition_penalty=repetition_penalty, early_stopping=True ) print('\033[96m' + prompt + '\033[0m') for i in range(len(output)): print(tokenizer.decode(output[i], skip_special_tokens=True) + '\n') ``` These are examples of prompts generating and testing the model with the website [STABLE DIFFUSION XL](https://clipdrop.co/) for the stable diffusion model generating images from prompts ``` a beautiful female a beautiful female woman, and she's got the best hair in this world. I'm not saying her look is bad (I think it has to be), but my point was that when one looks at these things like we're all looking for something different about our bodies as individuals they are completely wrong; there isn't anything inherently evil with being an animal or having two legs instead of just walking on both sides of you while holding your other leg up so tightly around yourself - no matter how ``` ![Image Alt Text](https://huggingface.co/Falah/stable_diffusion_prompts_gen/resolve/main/784df68d-8dad-41b6-9e15-fa16d9ece829.png) ## another generating prompts ``` a beautiful female and she's been in the business for over 30 years. I've had my fair share of bad things, and I'm sure many more will befall me at some point as well… but it is one thing when you have such an incredible woman on your team that makes life so difficult to bear (aside from being very much human) while also having her back with no regard whatsoever towards any personal issues or even just trying desperately hard not too far away! And ``` ![Image Alt Text](https://huggingface.co/Falah/stable_diffusion_prompts_gen/resolve/main/461e2488-a813-4375-86e0-833dcd7770de.png) -------------- ![Image Alt Text](https://huggingface.co/Falah/stable_diffusion_prompts_gen/resolve/main/e64f9888-66a8-4ba8-9b71-42d976eef84d.png) Feel free to modify the parameters like `prompt`, `temperature`, `top_k`, etc., to experiment with different outputs. ## Citation If you use this model or the associated dataset in your research or projects, please cite it as follows: ``` @sd_prompts{stable_diffussion_prompts_generating_gpt2), author = {Falah.G.Salieh}, title = {Stable Diffusion Prompts Generating By fine-tuning GPT2 }, year = {2023}, publisher = {Hugging Face}, url = {https://huggingface.co/Falah/stable_diffusion_prompts_gen}, } ``` ## License This project is licensed under the Apache License, Version 2.0. Please see the [LICENSE](link-to-license-file) file for more details.