Instructions to use kkboy1/gpt2_trained2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kkboy1/gpt2_trained2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kkboy1/gpt2_trained2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kkboy1/gpt2_trained2") model = AutoModelForCausalLM.from_pretrained("kkboy1/gpt2_trained2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kkboy1/gpt2_trained2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kkboy1/gpt2_trained2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kkboy1/gpt2_trained2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kkboy1/gpt2_trained2
- SGLang
How to use kkboy1/gpt2_trained2 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 "kkboy1/gpt2_trained2" \ --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": "kkboy1/gpt2_trained2", "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 "kkboy1/gpt2_trained2" \ --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": "kkboy1/gpt2_trained2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kkboy1/gpt2_trained2 with Docker Model Runner:
docker model run hf.co/kkboy1/gpt2_trained2
Download trainer_state.json from kkboy1/gpt2_trained2: direct link, hf CLI and curl.
- Browser
- Download file 792 Bytes
-
https://huggingface.co/kkboy1/gpt2_trained2/resolve/main/trainer_state.json
- Command line
-
hf download hf://kkboy1/gpt2_trained2/trainer_state.json
-
curl -L -o trainer_state.json https://huggingface.co/kkboy1/gpt2_trained2/resolve/main/trainer_state.json
792 Bytes
| { | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 18.51851851851852, | |
| "eval_steps": 500, | |
| "global_step": 1500, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 6.17, | |
| "learning_rate": 3.45679012345679e-05, | |
| "loss": 2.7366, | |
| "step": 500 | |
| }, | |
| { | |
| "epoch": 12.35, | |
| "learning_rate": 1.91358024691358e-05, | |
| "loss": 2.099, | |
| "step": 1000 | |
| }, | |
| { | |
| "epoch": 18.52, | |
| "learning_rate": 3.7037037037037037e-06, | |
| "loss": 1.8147, | |
| "step": 1500 | |
| } | |
| ], | |
| "logging_steps": 500, | |
| "max_steps": 1620, | |
| "num_train_epochs": 20, | |
| "save_steps": 500, | |
| "total_flos": 1553642422272000.0, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |