HuggingFaceH4/no_robots
Viewer • Updated • 10k • 9.1k • 546
How to use k050506koch/GPT4-dev-177M-1511-Instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="k050506koch/GPT4-dev-177M-1511-Instruct", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("k050506koch/GPT4-dev-177M-1511-Instruct", trust_remote_code=True, dtype="auto")How to use k050506koch/GPT4-dev-177M-1511-Instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "k050506koch/GPT4-dev-177M-1511-Instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "k050506koch/GPT4-dev-177M-1511-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/k050506koch/GPT4-dev-177M-1511-Instruct
How to use k050506koch/GPT4-dev-177M-1511-Instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "k050506koch/GPT4-dev-177M-1511-Instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "k050506koch/GPT4-dev-177M-1511-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "k050506koch/GPT4-dev-177M-1511-Instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "k050506koch/GPT4-dev-177M-1511-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use k050506koch/GPT4-dev-177M-1511-Instruct with Docker Model Runner:
docker model run hf.co/k050506koch/GPT4-dev-177M-1511-Instruct
Instruction-tuned checkpoint of the small GPT4-style model (NOT the actual implementation GPT-4 yet) after 1200 SFT steps on the HuggingFaceH4/no_robots conversational dataset. This is a lightweight research model; expect modest capabilities and occasional incoherence (the base model scores ~29% on MMLU).
gpt4dev implementation; requires trust_remote_code=True).no_robots with Harmony-style chat formatting, assistant-only loss masking, cosine LR schedule, AdamW.<|start|>assistant<|channel|>final<|message|> and <|end|> are included in tokenizer_config.json/special_tokens_map.json.from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "k050506koch/GPT4-dev-177M-1511-Instruct"
tokenizer = AutoTokenizer.from_pretrained("k050506koch/GPT4-dev-177M-1511-Instruct")
model = AutoModelForCausalLM.from_pretrained("k050506koch/GPT4-dev-177M-1511-Instruct", trust_remote_code=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
messages = [
{"role": "user", "content": "Write a short welcome message for new contributors."}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
)
output = model.generate(**inputs, max_new_tokens=128, temperature=0.7, top_p=0.9)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Evaluated with python3.13 eval_sft.py on mps, limited sample sizes.
To rerun locally:
python3.13 eval_sft.py --model-path k050506koch/GPT4-dev-177M-1511-Instruct \
--hellaswag-max-examples 500 --mmlu-max-examples 200 \
--mmlu-tasks abstract_algebra college_biology us_foreign_policy moral_scenarios
MIT
Base model
k050506koch/GPT4-dev-177M-1511