Text Generation
Transformers
PyTorch
TensorBoard
gpt2
Trained with AutoTrain
text-generation-inference
Instructions to use mluca/traj_gpt2_small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mluca/traj_gpt2_small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mluca/traj_gpt2_small")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mluca/traj_gpt2_small") model = AutoModelForCausalLM.from_pretrained("mluca/traj_gpt2_small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mluca/traj_gpt2_small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mluca/traj_gpt2_small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mluca/traj_gpt2_small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mluca/traj_gpt2_small
- SGLang
How to use mluca/traj_gpt2_small 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 "mluca/traj_gpt2_small" \ --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": "mluca/traj_gpt2_small", "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 "mluca/traj_gpt2_small" \ --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": "mluca/traj_gpt2_small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mluca/traj_gpt2_small with Docker Model Runner:
docker model run hf.co/mluca/traj_gpt2_small
| { | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 3.0, | |
| "global_step": 102, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.18, | |
| "learning_rate": 0.00010909090909090909, | |
| "loss": 0.2103, | |
| "step": 6 | |
| }, | |
| { | |
| "epoch": 0.35, | |
| "learning_rate": 0.0001978021978021978, | |
| "loss": 0.1736, | |
| "step": 12 | |
| }, | |
| { | |
| "epoch": 0.53, | |
| "learning_rate": 0.00018461538461538463, | |
| "loss": 0.1319, | |
| "step": 18 | |
| }, | |
| { | |
| "epoch": 0.71, | |
| "learning_rate": 0.00017142857142857143, | |
| "loss": 0.1167, | |
| "step": 24 | |
| }, | |
| { | |
| "epoch": 0.88, | |
| "learning_rate": 0.00015824175824175824, | |
| "loss": 0.1057, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 1.06, | |
| "learning_rate": 0.00014505494505494506, | |
| "loss": 0.0955, | |
| "step": 36 | |
| }, | |
| { | |
| "epoch": 1.24, | |
| "learning_rate": 0.00013186813186813188, | |
| "loss": 0.0915, | |
| "step": 42 | |
| }, | |
| { | |
| "epoch": 1.41, | |
| "learning_rate": 0.00011868131868131869, | |
| "loss": 0.0833, | |
| "step": 48 | |
| }, | |
| { | |
| "epoch": 1.59, | |
| "learning_rate": 0.0001054945054945055, | |
| "loss": 0.0807, | |
| "step": 54 | |
| }, | |
| { | |
| "epoch": 1.76, | |
| "learning_rate": 9.230769230769232e-05, | |
| "loss": 0.0751, | |
| "step": 60 | |
| }, | |
| { | |
| "epoch": 1.94, | |
| "learning_rate": 7.912087912087912e-05, | |
| "loss": 0.0723, | |
| "step": 66 | |
| }, | |
| { | |
| "epoch": 2.12, | |
| "learning_rate": 6.593406593406594e-05, | |
| "loss": 0.0655, | |
| "step": 72 | |
| }, | |
| { | |
| "epoch": 2.29, | |
| "learning_rate": 5.274725274725275e-05, | |
| "loss": 0.0635, | |
| "step": 78 | |
| }, | |
| { | |
| "epoch": 2.47, | |
| "learning_rate": 3.956043956043956e-05, | |
| "loss": 0.0605, | |
| "step": 84 | |
| }, | |
| { | |
| "epoch": 2.65, | |
| "learning_rate": 2.6373626373626374e-05, | |
| "loss": 0.0592, | |
| "step": 90 | |
| }, | |
| { | |
| "epoch": 2.82, | |
| "learning_rate": 1.3186813186813187e-05, | |
| "loss": 0.0564, | |
| "step": 96 | |
| }, | |
| { | |
| "epoch": 3.0, | |
| "learning_rate": 0.0, | |
| "loss": 0.0547, | |
| "step": 102 | |
| } | |
| ], | |
| "max_steps": 102, | |
| "num_train_epochs": 3, | |
| "total_flos": 191627834425344.0, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |