karpathy/tinystories-gpt4-clean
Viewer • Updated • 2.73M • 2.23k • 78
How to use DireDreadlord/TinyStories-GPT-Neo-LoRA with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="DireDreadlord/TinyStories-GPT-Neo-LoRA") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("DireDreadlord/TinyStories-GPT-Neo-LoRA", dtype="auto")How to use DireDreadlord/TinyStories-GPT-Neo-LoRA with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "DireDreadlord/TinyStories-GPT-Neo-LoRA"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "DireDreadlord/TinyStories-GPT-Neo-LoRA",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/DireDreadlord/TinyStories-GPT-Neo-LoRA
How to use DireDreadlord/TinyStories-GPT-Neo-LoRA with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "DireDreadlord/TinyStories-GPT-Neo-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": "DireDreadlord/TinyStories-GPT-Neo-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 "DireDreadlord/TinyStories-GPT-Neo-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": "DireDreadlord/TinyStories-GPT-Neo-LoRA",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use DireDreadlord/TinyStories-GPT-Neo-LoRA with Docker Model Runner:
docker model run hf.co/DireDreadlord/TinyStories-GPT-Neo-LoRA
This repo contains a LoRA adapter for the "EleutherAI/gpt-neo-125m" which has been trained on the karpathy/tinystories-gpt4-clean dataset for text generation.
This adapter was trained with the following settings:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = "EleutherAI/gpt-neo-125m"
adapter_repo = "DireDreadlord/TinyStories-GPT-Neo-LoRA"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model)
model = PeftModel.from_pretrained(model, adapter_repo)
EleutherAI/gpt-neo-125m).from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = "EleutherAI/gpt-neo-125m"
adapter_path = "./gptn125-lora-tinystories"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model)
model = PeftModel.from_pretrained(model, adapter_path)
text = "Once upon a time"
inputs = tokenizer(text, return_tensors="pt").input_ids
outputs = model.generate(inputs, max_length=150, do_sample=True, top_p=0.95, temperature=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
adapter_model.safetensors — LoRA adapter weightsadapter_config.json — LoRA configuration and metadatatraining_args.bin — training arguments saved by Hugging Face TrainerREADME.md — model card and usage instructionsBase model
EleutherAI/gpt-neo-125m