{"id":13729685,"url":"https://github.com/daspartho/prompt-extend","last_synced_at":"2025-06-19T16:33:29.380Z","repository":{"id":64923657,"uuid":"560295234","full_name":"daspartho/prompt-extend","owner":"daspartho","description":"extending stable diffusion prompts with suitable style cues using text generation","archived":false,"fork":false,"pushed_at":"2022-12-20T19:36:54.000Z","size":4501,"stargazers_count":176,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-03T02:21:48.334Z","etag":null,"topics":["deep-learning","gpt-2","huggingface-spaces","huggingface-transformers","machine-learning","nlp","prompt","stable-diffusion","text-generation"],"latest_commit_sha":null,"homepage":"https://huggingface.co/spaces/daspartho/prompt-extend","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daspartho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-01T06:48:27.000Z","updated_at":"2025-01-24T18:34:44.000Z","dependencies_parsed_at":"2023-01-30T01:45:47.644Z","dependency_job_id":null,"html_url":"https://github.com/daspartho/prompt-extend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daspartho%2Fprompt-extend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daspartho%2Fprompt-extend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daspartho%2Fprompt-extend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daspartho%2Fprompt-extend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daspartho","download_url":"https://codeload.github.com/daspartho/prompt-extend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daspartho%2Fprompt-extend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258669599,"owners_count":22738747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","gpt-2","huggingface-spaces","huggingface-transformers","machine-learning","nlp","prompt","stable-diffusion","text-generation"],"created_at":"2024-08-03T02:01:03.813Z","updated_at":"2025-06-19T16:33:24.371Z","avatar_url":"https://github.com/daspartho.png","language":"Jupyter Notebook","funding_links":[],"categories":["Large Language Models (LLMs)"],"sub_categories":["Prompt Engineering"],"readme":"# Prompt Extend\n[![Generic badge](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue.svg)](https://huggingface.co/spaces/daspartho/prompt-extend)\n\nText generation model for generating suitable style cues given the main idea for a prompt.\n\nPlay with it on [HuggingFace Space](https://huggingface.co/spaces/daspartho/prompt-extend). \n\n[Tokenizer](https://huggingface.co/daspartho/prompt-tokenizer) and [Model](https://huggingface.co/daspartho/prompt-extend) on HuggingFace Hub.\n\n# Usage\n\n```python\nfrom transformers import pipeline\n\ntext_pipe = pipeline('text-generation', model='daspartho/prompt-extend')\n\nprompt = \"peaceful village landscape\"\nextended_prompt = text_pipe(prompt, num_return_sequences=1)[0][\"generated_text\"]\nprint(extended_prompt)\n```\n\n```python\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\ntokenizer = AutoTokenizer.from_pretrained(\"daspartho/prompt-extend\")\n\nmodel = AutoModelForCausalLM.from_pretrained(\"daspartho/prompt-extend\")\n```\n\n# Code\n- [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.\n- [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.\n- [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).\n- [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.\n- [app.ipynb](https://github.com/daspartho/prompt-extend/blob/main/app.ipynb): Gradio app for the model.\n\n# Examples\n![](examples/0.png)\n![](examples/1.png)\n![](examples/2.png)\n![](examples/3.png)\n![](examples/4.png)\n\n# Contributing\nIf 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!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaspartho%2Fprompt-extend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaspartho%2Fprompt-extend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaspartho%2Fprompt-extend/lists"}