Text Generation
Transformers
Safetensors
gemma2
Generated from Trainer
sft
trl
hf_jobs
text-generation-inference
Instructions to use KexuanShi/sft_gemma2_2b_code_layerdrop_p005 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KexuanShi/sft_gemma2_2b_code_layerdrop_p005 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KexuanShi/sft_gemma2_2b_code_layerdrop_p005")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KexuanShi/sft_gemma2_2b_code_layerdrop_p005") model = AutoModelForCausalLM.from_pretrained("KexuanShi/sft_gemma2_2b_code_layerdrop_p005", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KexuanShi/sft_gemma2_2b_code_layerdrop_p005 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KexuanShi/sft_gemma2_2b_code_layerdrop_p005" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KexuanShi/sft_gemma2_2b_code_layerdrop_p005", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/KexuanShi/sft_gemma2_2b_code_layerdrop_p005
- SGLang
How to use KexuanShi/sft_gemma2_2b_code_layerdrop_p005 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "KexuanShi/sft_gemma2_2b_code_layerdrop_p005" \ --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": "KexuanShi/sft_gemma2_2b_code_layerdrop_p005", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "KexuanShi/sft_gemma2_2b_code_layerdrop_p005" \ --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": "KexuanShi/sft_gemma2_2b_code_layerdrop_p005", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use KexuanShi/sft_gemma2_2b_code_layerdrop_p005 with Docker Model Runner:
docker model run hf.co/KexuanShi/sft_gemma2_2b_code_layerdrop_p005
Download checkpoint-189/trainer_state.json from KexuanShi/sft_gemma2_2b_code_layerdrop_p005: direct link, hf CLI and curl.
- Browser
- Download file 6.04 kB
-
https://huggingface.co/KexuanShi/sft_gemma2_2b_code_layerdrop_p005/resolve/main/checkpoint-189/trainer_state.json
- Command line
-
hf download hf://KexuanShi/sft_gemma2_2b_code_layerdrop_p005/checkpoint-189/trainer_state.json
-
curl -L -o trainer_state.json https://huggingface.co/KexuanShi/sft_gemma2_2b_code_layerdrop_p005/resolve/main/checkpoint-189/trainer_state.json
6.04 kB
| { | |
| "best_global_step": null, | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 1.0, | |
| "eval_steps": 500, | |
| "global_step": 189, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "entropy": 1.2536803647875785, | |
| "epoch": 0.05291005291005291, | |
| "grad_norm": 8.8125, | |
| "learning_rate": 3.2142857142857147e-06, | |
| "loss": 1.1722795486450195, | |
| "mean_token_accuracy": 0.7258133076131343, | |
| "num_tokens": 710093.0, | |
| "step": 10 | |
| }, | |
| { | |
| "entropy": 0.9760579235851765, | |
| "epoch": 0.10582010582010581, | |
| "grad_norm": 2.65625, | |
| "learning_rate": 6.785714285714287e-06, | |
| "loss": 0.9763177871704102, | |
| "mean_token_accuracy": 0.7567757397890091, | |
| "num_tokens": 1429271.0, | |
| "step": 20 | |
| }, | |
| { | |
| "entropy": 0.794147289544344, | |
| "epoch": 0.15873015873015872, | |
| "grad_norm": 2.46875, | |
| "learning_rate": 1.0357142857142859e-05, | |
| "loss": 0.8046525001525879, | |
| "mean_token_accuracy": 0.7873034350574016, | |
| "num_tokens": 2149735.0, | |
| "step": 30 | |
| }, | |
| { | |
| "entropy": 0.7088500954210758, | |
| "epoch": 0.21164021164021163, | |
| "grad_norm": 1.4609375, | |
| "learning_rate": 1.3928571428571429e-05, | |
| "loss": 0.7121071815490723, | |
| "mean_token_accuracy": 0.8070594437420369, | |
| "num_tokens": 2868867.0, | |
| "step": 40 | |
| }, | |
| { | |
| "entropy": 0.683020292967558, | |
| "epoch": 0.26455026455026454, | |
| "grad_norm": 1.46875, | |
| "learning_rate": 1.7500000000000002e-05, | |
| "loss": 0.68443603515625, | |
| "mean_token_accuracy": 0.8138657048344612, | |
| "num_tokens": 3582476.0, | |
| "step": 50 | |
| }, | |
| { | |
| "entropy": 0.6564815938472748, | |
| "epoch": 0.31746031746031744, | |
| "grad_norm": 1.4296875, | |
| "learning_rate": 1.999986795783372e-05, | |
| "loss": 0.6578450202941895, | |
| "mean_token_accuracy": 0.8192978233098984, | |
| "num_tokens": 4287689.0, | |
| "step": 60 | |
| }, | |
| { | |
| "entropy": 0.6446133196353913, | |
| "epoch": 0.37037037037037035, | |
| "grad_norm": 1.5859375, | |
| "learning_rate": 1.9997520638548385e-05, | |
| "loss": 0.651158332824707, | |
| "mean_token_accuracy": 0.8207244381308556, | |
| "num_tokens": 5011191.0, | |
| "step": 70 | |
| }, | |
| { | |
| "entropy": 0.6360202118754387, | |
| "epoch": 0.42328042328042326, | |
| "grad_norm": 1.3984375, | |
| "learning_rate": 1.9992239841688418e-05, | |
| "loss": 0.6350794792175293, | |
| "mean_token_accuracy": 0.8251068785786628, | |
| "num_tokens": 5714842.0, | |
| "step": 80 | |
| }, | |
| { | |
| "entropy": 0.6189912840723991, | |
| "epoch": 0.47619047619047616, | |
| "grad_norm": 1.328125, | |
| "learning_rate": 1.9984027116747914e-05, | |
| "loss": 0.622182559967041, | |
| "mean_token_accuracy": 0.8279523886740208, | |
| "num_tokens": 6424614.0, | |
| "step": 90 | |
| }, | |
| { | |
| "entropy": 0.6159785229712724, | |
| "epoch": 0.5291005291005291, | |
| "grad_norm": 1.3671875, | |
| "learning_rate": 1.997288487350878e-05, | |
| "loss": 0.617555046081543, | |
| "mean_token_accuracy": 0.8284852005541324, | |
| "num_tokens": 7139778.0, | |
| "step": 100 | |
| }, | |
| { | |
| "entropy": 0.6129939660429955, | |
| "epoch": 0.582010582010582, | |
| "grad_norm": 1.328125, | |
| "learning_rate": 1.9958816381333684e-05, | |
| "loss": 0.6128347873687744, | |
| "mean_token_accuracy": 0.8294584318995476, | |
| "num_tokens": 7852540.0, | |
| "step": 110 | |
| }, | |
| { | |
| "entropy": 0.6052542962133884, | |
| "epoch": 0.6349206349206349, | |
| "grad_norm": 1.3359375, | |
| "learning_rate": 1.994182576820673e-05, | |
| "loss": 0.6046356201171875, | |
| "mean_token_accuracy": 0.831394524872303, | |
| "num_tokens": 8568056.0, | |
| "step": 120 | |
| }, | |
| { | |
| "entropy": 0.6013224326074124, | |
| "epoch": 0.6878306878306878, | |
| "grad_norm": 1.3203125, | |
| "learning_rate": 1.9921918019522238e-05, | |
| "loss": 0.6063410758972168, | |
| "mean_token_accuracy": 0.8313738636672496, | |
| "num_tokens": 9276742.0, | |
| "step": 130 | |
| }, | |
| { | |
| "entropy": 0.5983927462249994, | |
| "epoch": 0.7407407407407407, | |
| "grad_norm": 1.3125, | |
| "learning_rate": 1.9899098976621922e-05, | |
| "loss": 0.5977112770080566, | |
| "mean_token_accuracy": 0.8335464030504227, | |
| "num_tokens": 9990163.0, | |
| "step": 140 | |
| }, | |
| { | |
| "entropy": 0.5922725383192301, | |
| "epoch": 0.7936507936507936, | |
| "grad_norm": 1.5078125, | |
| "learning_rate": 1.9873375335080915e-05, | |
| "loss": 0.5917873382568359, | |
| "mean_token_accuracy": 0.8347524181008339, | |
| "num_tokens": 10710006.0, | |
| "step": 150 | |
| }, | |
| { | |
| "entropy": 0.5920293003320694, | |
| "epoch": 0.8465608465608465, | |
| "grad_norm": 1.3046875, | |
| "learning_rate": 1.9844754642743164e-05, | |
| "loss": 0.5962053298950195, | |
| "mean_token_accuracy": 0.8335559628903866, | |
| "num_tokens": 11416822.0, | |
| "step": 160 | |
| }, | |
| { | |
| "entropy": 0.5966673269867897, | |
| "epoch": 0.8994708994708994, | |
| "grad_norm": 1.3828125, | |
| "learning_rate": 1.981324529750672e-05, | |
| "loss": 0.6019061088562012, | |
| "mean_token_accuracy": 0.83258865326643, | |
| "num_tokens": 12123118.0, | |
| "step": 170 | |
| }, | |
| { | |
| "entropy": 0.5854565776884556, | |
| "epoch": 0.9523809523809523, | |
| "grad_norm": 1.359375, | |
| "learning_rate": 1.9778856544859647e-05, | |
| "loss": 0.5845203399658203, | |
| "mean_token_accuracy": 0.8360438510775566, | |
| "num_tokens": 12831058.0, | |
| "step": 180 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 1890, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 10, | |
| "save_steps": 500, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": false | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 2.431109426220892e+17, | |
| "train_batch_size": 8, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |