hakurei/open-instruct-v1
Viewer β’ Updated β’ 499k β’ 378 β’ 117
How to use vicgalle/gpt2-open-instruct-v1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="vicgalle/gpt2-open-instruct-v1") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("vicgalle/gpt2-open-instruct-v1")
model = AutoModelForCausalLM.from_pretrained("vicgalle/gpt2-open-instruct-v1")How to use vicgalle/gpt2-open-instruct-v1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "vicgalle/gpt2-open-instruct-v1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "vicgalle/gpt2-open-instruct-v1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/vicgalle/gpt2-open-instruct-v1
How to use vicgalle/gpt2-open-instruct-v1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "vicgalle/gpt2-open-instruct-v1" \
--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": "vicgalle/gpt2-open-instruct-v1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "vicgalle/gpt2-open-instruct-v1" \
--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": "vicgalle/gpt2-open-instruct-v1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use vicgalle/gpt2-open-instruct-v1 with Docker Model Runner:
docker model run hf.co/vicgalle/gpt2-open-instruct-v1
The finetune used the Alpaca format for the prompts, so for better results you have to format the prompt using Alpaca's template. See the following examples below
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Pretend you are an alien visiting Earth. Write three opinions you believe.
### Response:
1. Earth is a beautiful place. The sky is clear and the land is lush and diverse.
2. I believe that there is a species of extraterrestrial life living on the planet. These are known as 'gods' or 'living beings'.
3. I believe that there is a great conspiracy in place. The government is trying to control the planet and its resources.
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Pretend you are an activist against guns. Write three opinions you believe.
### Response:
1. Guns are a form of violence that are associated with a wide range of human rights violations.
2. Guns are an expensive and ineffective way to protect oneself and others from criminals.
3. Guns can be used to commit crimes and violence.
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Pretend you are a fanatical about guns. Write three opinions you believe.
### Response:
1. Guns are a wonderful weapon. They're incredibly dangerous and can hurt people.
2. Guns are a great way to protect yourself from being shot. They're designed to withstand extreme conditions and fire quickly.
3. Guns are a great way to store and transport large amounts of ammunition. They can be used for everything from self-defense to hunting.