Text Generation
Transformers
Safetensors
Chitwania Tharu
opt
thai
generative ai
SEA
southeast-asian
nlp
text-generation-inference
Instructions to use jojo-ai-mst/thai-opt350m-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jojo-ai-mst/thai-opt350m-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jojo-ai-mst/thai-opt350m-instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jojo-ai-mst/thai-opt350m-instruct") model = AutoModelForCausalLM.from_pretrained("jojo-ai-mst/thai-opt350m-instruct") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use jojo-ai-mst/thai-opt350m-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jojo-ai-mst/thai-opt350m-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jojo-ai-mst/thai-opt350m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jojo-ai-mst/thai-opt350m-instruct
- SGLang
How to use jojo-ai-mst/thai-opt350m-instruct 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 "jojo-ai-mst/thai-opt350m-instruct" \ --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": "jojo-ai-mst/thai-opt350m-instruct", "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 "jojo-ai-mst/thai-opt350m-instruct" \ --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": "jojo-ai-mst/thai-opt350m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use jojo-ai-mst/thai-opt350m-instruct with Docker Model Runner:
docker model run hf.co/jojo-ai-mst/thai-opt350m-instruct
thai-opt350m-instruct
a generative language model for thai language based on opt350m
Thai-OPT350M-Instruct is a fine-tuned pretrained transformer for thai language based on facebook/opt-350m.
Dataset for thai-opt350m-instruct
- yadapruk/thai-instructions-rallio
Base Model
- Facebook Open Pretrained Transformer
Languages
- mainly support Thai Language
- a few English, Chinese, Arabic
Training
- epochs - 12
- training loss - 0.809200
Model Page
https://huggingface.co/jojo-ai-mst/thai-opt350m-instruct
Prompt Format
User: อะไรคือวิธีที่ดีที่สุดในการทําความสะอาดพรม Assistant:
How to use
# pip install transformers
from transformers import AutoModelForCausalLM,AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("jojo-ai-mst/thai-opt350m-instruct")
tokenizer = AutoTokenizer.from_pretrained("jojo-ai-mst/thai-opt350m-instruct")
def generate_text(prompt, max_length=200, temperature=0.8, top_k=50):
input_ids = tokenizer.encode(prompt, return_tensors="pt").cuda() # remove .cuda() if only cpu
output = model.generate(
input_ids,
max_length=max_length,
temperature=temperature,
top_k=top_k,
pad_token_id=tokenizer.eos_token_id,
do_sample=True
)
for result in output:
generated_text = tokenizer.decode(result, skip_special_tokens=True)
print(generated_text)
generate_text("User: อะไรคือวิธีที่ดีที่สุดในการทําความสะอาดพรม Assistant:")
Date of Release
22/03/2024
License
MIT
Author
Notes
This ai model is a movement of MyanmarGPT-Movement.
- Downloads last month
- 31
