Instructions to use Ronels/llmtwinggpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Ronels/llmtwinggpt2 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("gpt2") model = PeftModel.from_pretrained(base_model, "Ronels/llmtwinggpt2") - Transformers
How to use Ronels/llmtwinggpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ronels/llmtwinggpt2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Ronels/llmtwinggpt2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Ronels/llmtwinggpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ronels/llmtwinggpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ronels/llmtwinggpt2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Ronels/llmtwinggpt2
- SGLang
How to use Ronels/llmtwinggpt2 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 "Ronels/llmtwinggpt2" \ --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": "Ronels/llmtwinggpt2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Ronels/llmtwinggpt2" \ --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": "Ronels/llmtwinggpt2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Ronels/llmtwinggpt2 with Docker Model Runner:
docker model run hf.co/Ronels/llmtwinggpt2
| { | |
| "best_global_step": null, | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 3.0, | |
| "eval_steps": 500, | |
| "global_step": 132, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.22857142857142856, | |
| "grad_norm": 0.6778433322906494, | |
| "learning_rate": 3.2142857142857144e-05, | |
| "loss": 4.6452, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.45714285714285713, | |
| "grad_norm": 0.6552432775497437, | |
| "learning_rate": 4.9778820775100185e-05, | |
| "loss": 4.7314, | |
| "step": 20 | |
| }, | |
| { | |
| "epoch": 0.6857142857142857, | |
| "grad_norm": 1.0648839473724365, | |
| "learning_rate": 4.803279944676032e-05, | |
| "loss": 4.4278, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 0.9142857142857143, | |
| "grad_norm": 0.7492648959159851, | |
| "learning_rate": 4.466378889506607e-05, | |
| "loss": 4.2958, | |
| "step": 40 | |
| }, | |
| { | |
| "epoch": 1.1371428571428572, | |
| "grad_norm": 1.1295640468597412, | |
| "learning_rate": 3.990918396346254e-05, | |
| "loss": 4.5745, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 1.3657142857142857, | |
| "grad_norm": 1.1639342308044434, | |
| "learning_rate": 3.410401438132056e-05, | |
| "loss": 4.2608, | |
| "step": 60 | |
| }, | |
| { | |
| "epoch": 1.5942857142857143, | |
| "grad_norm": 1.0422941446304321, | |
| "learning_rate": 2.7657337141184138e-05, | |
| "loss": 4.1288, | |
| "step": 70 | |
| }, | |
| { | |
| "epoch": 1.822857142857143, | |
| "grad_norm": 0.8440783023834229, | |
| "learning_rate": 2.1023412599523204e-05, | |
| "loss": 4.0658, | |
| "step": 80 | |
| }, | |
| { | |
| "epoch": 2.045714285714286, | |
| "grad_norm": 0.7604417204856873, | |
| "learning_rate": 1.4669695355790552e-05, | |
| "loss": 4.2423, | |
| "step": 90 | |
| }, | |
| { | |
| "epoch": 2.2742857142857145, | |
| "grad_norm": 3.8797717094421387, | |
| "learning_rate": 9.043895408879505e-06, | |
| "loss": 3.9711, | |
| "step": 100 | |
| }, | |
| { | |
| "epoch": 2.5028571428571427, | |
| "grad_norm": 0.7863895893096924, | |
| "learning_rate": 4.542430602295774e-06, | |
| "loss": 4.1899, | |
| "step": 110 | |
| }, | |
| { | |
| "epoch": 2.7314285714285713, | |
| "grad_norm": 1.85634446144104, | |
| "learning_rate": 1.4824933332241692e-06, | |
| "loss": 4.1274, | |
| "step": 120 | |
| }, | |
| { | |
| "epoch": 2.96, | |
| "grad_norm": 0.6992499232292175, | |
| "learning_rate": 7.969982423124689e-08, | |
| "loss": 4.4828, | |
| "step": 130 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 132, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 3, | |
| "save_steps": 100, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": true | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 46939787919360.0, | |
| "train_batch_size": 1, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |