HuggingFaceFW/fineweb-edu
Viewer • Updated • 3.5B • 362k • 1.19k
How to use jrahn/gpt2_350M_edu_hermes with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jrahn/gpt2_350M_edu_hermes") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jrahn/gpt2_350M_edu_hermes")
model = AutoModelForCausalLM.from_pretrained("jrahn/gpt2_350M_edu_hermes")How to use jrahn/gpt2_350M_edu_hermes with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jrahn/gpt2_350M_edu_hermes"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jrahn/gpt2_350M_edu_hermes",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/jrahn/gpt2_350M_edu_hermes
How to use jrahn/gpt2_350M_edu_hermes with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jrahn/gpt2_350M_edu_hermes" \
--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": "jrahn/gpt2_350M_edu_hermes",
"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 "jrahn/gpt2_350M_edu_hermes" \
--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": "jrahn/gpt2_350M_edu_hermes",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use jrahn/gpt2_350M_edu_hermes with Docker Model Runner:
docker model run hf.co/jrahn/gpt2_350M_edu_hermes
Use the code below to get started with the model.
from transformers import pipeline
p = pipeline("text-generation", "jrahn/gpt2_350M_edu_hermes")
# instruction following
p("<|im_start|>user\nTeach me to fish.<|im_end|>\n<|im_start|>assistant\n", max_lenght=128)
#[{'generated_text': '<|im_start|>user\nTeach me to fish.<|im_end|>\n<|im_start|>assistant\nTo fish, you can start by learning the basics of fishing. First, you need to learn how to catch fish. Fish are a type of fish that are found in the ocean. They are also known as sea fish. They are a type of fish that are found in the ocean. They are a type of fish that are found in the ocean. They are a type of fish that are found in the ocean. They are a type of fish that are found in the ocean'}]
# text completion
p("In a shocking finding, scientist discovered a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English. ", max_length=128)
# [{'generated_text': 'In a shocking finding, scientist discovered a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English. \nThe researchers believe that the animals were able to communicate with each other by using a unique vocalization system. The researchers believe that the animals were able to communicate with each other by using a unique vocalization system.\nThe researchers believe that the animals were able to communicate with each other by using a unique vocalization system. The researchers believe that the animals were able to communicate with each other by using a unique'}]
Datasets used: Fineweb-Edu 10B + OpenHermes 2.5
Dataset proportions:
Params: 355M -> 710MB / checkpoint
Tokens: ~10B (10,287,579,136)
Total training time: ~30hrs
Hardware: 2x RTX4090
MFU: 71% (110,000 tok/s)
HellaSwag: 34.4
GTP2 350M, Causal Language Modeling
2x RTX4090