Instructions to use nakcnx/TGPT-2-345M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nakcnx/TGPT-2-345M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nakcnx/TGPT-2-345M")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nakcnx/TGPT-2-345M") model = AutoModelForCausalLM.from_pretrained("nakcnx/TGPT-2-345M") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nakcnx/TGPT-2-345M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nakcnx/TGPT-2-345M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nakcnx/TGPT-2-345M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nakcnx/TGPT-2-345M
- SGLang
How to use nakcnx/TGPT-2-345M 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 "nakcnx/TGPT-2-345M" \ --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": "nakcnx/TGPT-2-345M", "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 "nakcnx/TGPT-2-345M" \ --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": "nakcnx/TGPT-2-345M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nakcnx/TGPT-2-345M with Docker Model Runner:
docker model run hf.co/nakcnx/TGPT-2-345M
TGPT-2-345M
This model is a fine-tuned version of on an Thai Wikipedia dataset. It achieves the following results on the evaluation set:
- Train Loss: 2.6217
- Train Accuracy: 0.5400
- Epoch: 3
Model description
Intended uses & limitations
Training and evaluation data
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- optimizer: {'name': 'Adam', 'weight_decay': None, 'clipnorm': 1.0, 'global_clipnorm': None, 'clipvalue': None, 'use_ema': False, 'ema_momentum': 0.99, 'ema_overwrite_frequency': None, 'jit_compile': True, 'is_legacy_optimizer': False, 'learning_rate': 3e-05, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-08, 'amsgrad': False}
- training_precision: float32
Training results
| Train Loss | Train Accuracy | Epoch |
|---|---|---|
| 3.5955 | 0.4289 | 0 |
| 2.8630 | 0.5107 | 1 |
| 2.6217 | 0.5400 | 2 |
Framework versions
- Transformers 4.26.0
- TensorFlow 2.11.0
- Datasets 2.10.0
- Tokenizers 0.13.2
- Downloads last month
- 4