Instructions to use cactusfriend/nightmare-invokeai-prompts with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cactusfriend/nightmare-invokeai-prompts with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cactusfriend/nightmare-invokeai-prompts")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cactusfriend/nightmare-invokeai-prompts") model = AutoModelForCausalLM.from_pretrained("cactusfriend/nightmare-invokeai-prompts") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cactusfriend/nightmare-invokeai-prompts with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cactusfriend/nightmare-invokeai-prompts" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cactusfriend/nightmare-invokeai-prompts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cactusfriend/nightmare-invokeai-prompts
- SGLang
How to use cactusfriend/nightmare-invokeai-prompts with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "cactusfriend/nightmare-invokeai-prompts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cactusfriend/nightmare-invokeai-prompts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "cactusfriend/nightmare-invokeai-prompts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cactusfriend/nightmare-invokeai-prompts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cactusfriend/nightmare-invokeai-prompts with Docker Model Runner:
docker model run hf.co/cactusfriend/nightmare-invokeai-prompts
A model based upon the prompts of all the images in my InvokeAI's output directory, meant to be used with InvokeAI (a Stable Diffusion implementation/UI) to generate new, probably wild nightmare images.
This is mostly trained on positive prompts, though you may catch some words in [] brackets, which will be treated as negative. GPT-Neo is usually quite good at pairing parenthesis, quotation marks, etc - however, don't be too surprised if it generates something that's not quite InvokeAI prompt syntax.
To use this model, you can import it as a pipeline like so:
from transformers import pipeline
generator = pipeline(model="cactusfriend/nightmare-invokeai-prompts",
tokenizer="cactusfriend/nightmare-invokeai-prompts",
task="text-generation")
Here's an example function that'll generate by default 20 prompts, at a temperature of 1.8 which seems good for this model.
def makePrompts(prompt: str, *, p: float=0.9,
k: int = 40, num: int = 20,
temp: float = 1.8, mnt: int = 150):
outputs = generator(prompt, max_new_tokens=mnt,
temperature=temp, do_sample=True,
top_p=p, top_k=k, num_return_sequences=num)
items = set([i['generated_text'] for i in outputs])
print("-" * 60)
print("\n ---\n".join(items))
print("-" * 60)
Then, you can call it like so:
makePrompts("a photograph of")
# or, to change some defaults:
makePrompts("spaghetti all over", temp=1.4, p=0.92, k=45)
- Downloads last month
- 6