knkarthick/samsum
Viewer • Updated • 16.4k • 9.48k • 40
How to use RGarrido03/GPT2-LoRA with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
model = PeftModel.from_pretrained(base_model, "RGarrido03/GPT2-LoRA")How to use RGarrido03/GPT2-LoRA with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="RGarrido03/GPT2-LoRA") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("RGarrido03/GPT2-LoRA", dtype="auto")How to use RGarrido03/GPT2-LoRA with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "RGarrido03/GPT2-LoRA"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "RGarrido03/GPT2-LoRA",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/RGarrido03/GPT2-LoRA
How to use RGarrido03/GPT2-LoRA with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "RGarrido03/GPT2-LoRA" \
--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": "RGarrido03/GPT2-LoRA",
"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 "RGarrido03/GPT2-LoRA" \
--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": "RGarrido03/GPT2-LoRA",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use RGarrido03/GPT2-LoRA with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RGarrido03/GPT2-LoRA to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RGarrido03/GPT2-LoRA to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for RGarrido03/GPT2-LoRA to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="RGarrido03/GPT2-LoRA",
max_seq_length=2048,
)How to use RGarrido03/GPT2-LoRA with Docker Model Runner:
docker model run hf.co/RGarrido03/GPT2-LoRA
This model is a fine-tuned version of openai-community/gpt2 on the knkarthick/samsum dataset. It has been trained using TRL.
from transformers import pipeline
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
generator = pipeline("text-generation", model="None", device="cuda")
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
This model was trained with SFT.
The following hyperparameters were used during training:
| Parameter | Value |
|---|---|
| LoRA Rank ($r$) | 32 |
| LoRA Alpha (Scale) | 16.0 |
| LoRA Dropout | 0.0 |
| Learning Rate | 2e-4 |
| Optimizer | AdamW |
| Batch Size | 4 |
| Epochs | 3 |
| Seed | 3407 |
Training was monitored via Weights & Biases (W&B).
{
"_runtime": 1828,
"_step": 303,
"_timestamp": 1776940747.4150884,
"_wandb.runtime": 1828,
"eval/loss": 2.442631959915161,
"eval/runtime": 8.4963,
"eval/samples_per_second": 96.277,
"eval/steps_per_second": 24.128,
"total_flos": 4539887471702016,
"train/epoch": 3,
"train/global_step": 2763,
"train/grad_norm": 0.24430057406425476,
"train/learning_rate": 2.985074626865672e-7,
"train/loss": 2.5596,
"train_loss": 2.563603694569232,
"train_runtime": 1834.6214,
"train_samples_per_second": 24.088,
"train_steps_per_second": 1.506
}
Base model
openai-community/gpt2