Instructions to use pythainlp/KhanomTanLLM-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pythainlp/KhanomTanLLM-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pythainlp/KhanomTanLLM-3B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pythainlp/KhanomTanLLM-3B") model = AutoModelForCausalLM.from_pretrained("pythainlp/KhanomTanLLM-3B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use pythainlp/KhanomTanLLM-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pythainlp/KhanomTanLLM-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pythainlp/KhanomTanLLM-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/pythainlp/KhanomTanLLM-3B
- SGLang
How to use pythainlp/KhanomTanLLM-3B 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 "pythainlp/KhanomTanLLM-3B" \ --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": "pythainlp/KhanomTanLLM-3B", "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 "pythainlp/KhanomTanLLM-3B" \ --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": "pythainlp/KhanomTanLLM-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use pythainlp/KhanomTanLLM-3B with Docker Model Runner:
docker model run hf.co/pythainlp/KhanomTanLLM-3B
KhanomTan LLM (3B)
KhanomTan LLM is a bilingual language model trained in Thai and English from open source dataset by PyThaiNLP. We train the model from public dataset only. We public the dataset, source code, and model.
Repository: https://github.com/pythainlp/KhanomTanLLM
Codename: numfa-v2
Model Details
Model Description
The model was trained by easylm
Acknowledgements
Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC). We use TPU4-64 for training model about 8 days.
Thank you TPU Research Cloud and EasyLM project! We use EasyLM for pretraining model.
How to Get Started with the Model
Use the code below to get started with the model.
Example
# !pip install accelerate sentencepiece transformers bitsandbytes
import torch
from transformers import pipeline
pipe = pipeline("text-generation", model="numfa/numfa_v2-3b", torch_dtype=torch.bfloat16, device_map="auto")
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
outputs = pipe("test is", max_new_tokens=300, do_sample=True, temperature=0.9, top_k=50, top_p=0.95, no_repeat_ngram_size=2,typical_p=1.)
print(outputs[0]["generated_text"])
- Downloads last month
- 3