Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daspartho/prompt-extend
extending stable diffusion prompts with suitable style cues using text generation
https://github.com/daspartho/prompt-extend
deep-learning gpt-2 huggingface-spaces huggingface-transformers machine-learning nlp prompt stable-diffusion text-generation
Last synced: 3 months ago
JSON representation
extending stable diffusion prompts with suitable style cues using text generation
- Host: GitHub
- URL: https://github.com/daspartho/prompt-extend
- Owner: daspartho
- License: apache-2.0
- Created: 2022-11-01T06:48:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-20T19:36:54.000Z (almost 2 years ago)
- Last Synced: 2024-04-16T17:34:16.254Z (7 months ago)
- Topics: deep-learning, gpt-2, huggingface-spaces, huggingface-transformers, machine-learning, nlp, prompt, stable-diffusion, text-generation
- Language: Jupyter Notebook
- Homepage: https://huggingface.co/spaces/daspartho/prompt-extend
- Size: 4.29 MB
- Stars: 173
- Watchers: 4
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-generative-ai - daspartho/prompt-extend
README
# Prompt Extend
[![Generic badge](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue.svg)](https://huggingface.co/spaces/daspartho/prompt-extend)Text generation model for generating suitable style cues given the main idea for a prompt.
Play with it on [HuggingFace Space](https://huggingface.co/spaces/daspartho/prompt-extend).
[Tokenizer](https://huggingface.co/daspartho/prompt-tokenizer) and [Model](https://huggingface.co/daspartho/prompt-extend) on HuggingFace Hub.
# Usage
```python
from transformers import pipelinetext_pipe = pipeline('text-generation', model='daspartho/prompt-extend')
prompt = "peaceful village landscape"
extended_prompt = text_pipe(prompt, num_return_sequences=1)[0]["generated_text"]
print(extended_prompt)
``````python
from transformers import AutoTokenizer, AutoModelForCausalLMtokenizer = AutoTokenizer.from_pretrained("daspartho/prompt-extend")
model = AutoModelForCausalLM.from_pretrained("daspartho/prompt-extend")
```# Code
- [dataset.ipynb](https://github.com/daspartho/prompt-extend/blob/main/dataset.ipynb): Creating a [subset dataset](https://huggingface.co/datasets/daspartho/stable-diffusion-prompts) of [diffusiondb](https://huggingface.co/datasets/poloclub/diffusiondb) consisting of just unique prompts.
- [tokenizer.ipynb](https://github.com/daspartho/prompt-extend/blob/main/tokenizer.ipynb): Training a new tokenizer on the [dataset](https://huggingface.co/datasets/daspartho/stable-diffusion-prompts) of stable diffusion prompts.
- [model.ipynb](https://github.com/daspartho/prompt-extend/blob/main/model.ipynb): Training a GPT-2 model on the [dataset](https://huggingface.co/datasets/daspartho/stable-diffusion-prompts) of stable diffusion prompts using the [trained tokenizer](https://huggingface.co/daspartho/prompt-tokenizer).
- [inference.ipynb](https://github.com/daspartho/prompt-extend/blob/main/inference.ipynb): Trying the prompts generated using the [trained model](https://huggingface.co/daspartho/prompt-extend) with stable diffusion.
- [app.ipynb](https://github.com/daspartho/prompt-extend/blob/main/app.ipynb): Gradio app for the model.# Examples
![](examples/0.png)
![](examples/1.png)
![](examples/2.png)
![](examples/3.png)
![](examples/4.png)# Contributing
If you want to contribute code, simply create a pull request. If you have an idea, create an issue and the developers will look into it!