Instructions to use NasimB/gpt2-cl-length-sampling-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NasimB/gpt2-cl-length-sampling-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NasimB/gpt2-cl-length-sampling-2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NasimB/gpt2-cl-length-sampling-2") model = AutoModelForCausalLM.from_pretrained("NasimB/gpt2-cl-length-sampling-2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NasimB/gpt2-cl-length-sampling-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NasimB/gpt2-cl-length-sampling-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NasimB/gpt2-cl-length-sampling-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NasimB/gpt2-cl-length-sampling-2
- SGLang
How to use NasimB/gpt2-cl-length-sampling-2 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 "NasimB/gpt2-cl-length-sampling-2" \ --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": "NasimB/gpt2-cl-length-sampling-2", "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 "NasimB/gpt2-cl-length-sampling-2" \ --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": "NasimB/gpt2-cl-length-sampling-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NasimB/gpt2-cl-length-sampling-2 with Docker Model Runner:
docker model run hf.co/NasimB/gpt2-cl-length-sampling-2
gpt2-cl-length-sampling-2
This model is a fine-tuned version of gpt2 on the generator dataset. It achieves the following results on the evaluation set:
- Loss: 5.0138
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0005
- train_batch_size: 64
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 1000
- num_epochs: 1
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 6.5248 | 0.06 | 500 | 5.9478 |
| 5.2522 | 0.11 | 1000 | 5.5602 |
| 4.957 | 0.17 | 1500 | 5.3690 |
| 4.754 | 0.22 | 2000 | 5.2557 |
| 4.6118 | 0.28 | 2500 | 5.1715 |
| 4.4957 | 0.33 | 3000 | 5.1314 |
| 4.3901 | 0.39 | 3500 | 5.0888 |
| 4.2957 | 0.44 | 4000 | 5.0603 |
| 4.2028 | 0.5 | 4500 | 5.0352 |
| 4.1103 | 0.55 | 5000 | 5.0110 |
| 4.0272 | 0.61 | 5500 | 4.9948 |
| 3.9358 | 0.66 | 6000 | 4.9880 |
| 3.8622 | 0.72 | 6500 | 4.9728 |
| 3.7912 | 0.77 | 7000 | 4.9692 |
| 3.739 | 0.83 | 7500 | 4.9586 |
| 3.6971 | 0.88 | 8000 | 4.9557 |
| 3.6791 | 0.94 | 8500 | 4.9535 |
| 3.6652 | 0.99 | 9000 | 4.9530 |
Framework versions
- Transformers 4.26.1
- Pytorch 1.11.0+cu113
- Datasets 2.13.0
- Tokenizers 0.13.3
- Downloads last month
- 6