tatsu-lab/alpaca
Viewer • Updated • 52k • 88k • 1.36k
How to use FurkanNar/gpt-2_instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="FurkanNar/gpt-2_instruct") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("FurkanNar/gpt-2_instruct")
model = AutoModelForCausalLM.from_pretrained("FurkanNar/gpt-2_instruct", device_map="auto")How to use FurkanNar/gpt-2_instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "FurkanNar/gpt-2_instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "FurkanNar/gpt-2_instruct",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/FurkanNar/gpt-2_instruct
How to use FurkanNar/gpt-2_instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "FurkanNar/gpt-2_instruct" \
--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": "FurkanNar/gpt-2_instruct",
"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 "FurkanNar/gpt-2_instruct" \
--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": "FurkanNar/gpt-2_instruct",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use FurkanNar/gpt-2_instruct with Docker Model Runner:
docker model run hf.co/FurkanNar/gpt-2_instruct
This project uses a GPT-2 model (124M parameters) fine-tuned on the SVAMP (Simple Variants of Arithmetic Math word Problems) model, available at FurkanNar/gpt-2_svamp.
The model showed consistent improvement across epochs, with training loss decreasing from 0.7349 to 0.6216, indicating effective learning of the instruction-following task.
config.json - Model configurationgeneration_config.json - Generation parametersmodel.safetensors - Fine-tuned model weights (475MB)The application uses the official Alpaca instruction format for inference:
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{user_input}
### Response:
Example interaction with the fine-tuned model:
You: Hello
AI: Hi there! How can I help you today?
The model generation can be configured with the following parameters:
model_name: Hugging Face model identifier or local pathsystem_prompt: System prompt for the assistantmax_length: Maximum response lengthtemperature: Sampling temperature (default: 0.5)top_k: Top-k sampling parameter (default: 40)top_p: Nucleus sampling parameter (default: 0.9)repetition_penalty: Penalty for repeating tokens (default: 1.2)Base model
openai-community/gpt2