Instructions to use PygmalionAI/pygmalion-6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PygmalionAI/pygmalion-6b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PygmalionAI/pygmalion-6b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PygmalionAI/pygmalion-6b") model = AutoModelForCausalLM.from_pretrained("PygmalionAI/pygmalion-6b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use PygmalionAI/pygmalion-6b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PygmalionAI/pygmalion-6b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PygmalionAI/pygmalion-6b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PygmalionAI/pygmalion-6b
- SGLang
How to use PygmalionAI/pygmalion-6b 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 "PygmalionAI/pygmalion-6b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PygmalionAI/pygmalion-6b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "PygmalionAI/pygmalion-6b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PygmalionAI/pygmalion-6b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PygmalionAI/pygmalion-6b with Docker Model Runner:
docker model run hf.co/PygmalionAI/pygmalion-6b
Truncated or empty text response?
#30
by miloice2022 - opened
I have a Oobabooga 1.0.1 Runpod with API enabled. I am trying to use this pod as a Pygmalion REST API backend for a chat frontend.
If I fire a post API to the pod like this:
curl --request POST \
--url https://[redacted].proxy.runpod.net/api/v1/generate \
--header "accept: application/json" \
--header "content-type: application/json" \
--data u/- <<EOF
{
"prompt": "Can you tell me a joke?",
"do_sample": true,
"max_length": 300,
"temperature": 0.9
}
EOF
I will get a truncated response like this:
{"results": [{"text": "e* a joke or two that you know the significance of, Null?\nYou: You could always recursively call the function to do so!\n"}]}
This response feels truncated and generally very wrong.
If I follow the prompt suggestion from the Pygmalion 6B documentation:
curl --request POST \
--url https://[redacted].proxy.runpod.net/api/v1/generate \
--header "accept: application/json" \
--header "content-type: application/json" \
--data u/- <<EOF
{
"prompt": "AI's Persona: AI is a helpful assistant.
<START>
You: Hi!
AI: Hi! How can I help you?
You: What's the color of Apple?
AI: The color of Apple is red.
You: Are you happy?
AI: Yes I am happy. What about you?
You: Can you tell me a joke?
AI: ",
"do_sample": true,
"max_length": 300,
"temperature": 0.9
}
EOF
The response will either be truncated like the above, or even worse, an empty text response like this:
{"results": [{"text": ""}]}
Any idea what am I missing here?
Did you find a solutions?