Instructions to use typhoon-ai/typhoon-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use typhoon-ai/typhoon-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="typhoon-ai/typhoon-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("typhoon-ai/typhoon-7b") model = AutoModelForCausalLM.from_pretrained("typhoon-ai/typhoon-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use typhoon-ai/typhoon-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "typhoon-ai/typhoon-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "typhoon-ai/typhoon-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/typhoon-ai/typhoon-7b
- SGLang
How to use typhoon-ai/typhoon-7b 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 "typhoon-ai/typhoon-7b" \ --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": "typhoon-ai/typhoon-7b", "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 "typhoon-ai/typhoon-7b" \ --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": "typhoon-ai/typhoon-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use typhoon-ai/typhoon-7b with Docker Model Runner:
docker model run hf.co/typhoon-ai/typhoon-7b
About Evaluation
Hi, thanks for sharing the nice work. I have some problems with the evaluation. First, will the ThaiExam be pubic available? Second, what is the way to evaluate the benchmarks in Table 3? Since the pre-trained model didn't follow the instructions, whether directly compare the teacher forcing generation probability of different options?
Hi, thanks for sharing the nice work. I have some problems with the evaluation. First, will the ThaiExam be pubic available? Second, what is the way to evaluate the benchmarks in Table 3? Since the pre-trained model didn't follow the instructions, whether directly compare the teacher forcing generation probability of different options?
- We don't have plans to release ThaiExam at the moment.
- We employ the conventional multiple-choice assessment technique (https://crfm.stanford.edu/helm/classic/latest/), where questions and answers are presented in a multiple-choice format labeled "a, b, c, d, e." The model is then prompt to produce a single letter that represents the correct answer.
Hi @XiangGeng , thanks for your interest in our work. I suppose this is some extra info:
- Some of the datasets are available on HF thanks to OpenThaiGPT for releasing them. I believe it's similar to our datasets:
- ONET: https://huggingface.co/datasets/openthaigpt/thai-onet-exam
- IC: https://huggingface.co/datasets/openthaigpt/thai-investment-consultant-licensing-exams
- We use the HELM framework to perform evaluation. It performs a few-shot evaluation (e.g., 5 examples). Hence, even a pretrained model should be able to output 'a', 'b', 'c', 'd', or 'e' in this setup. HELM does not use teaching forcing generation probability, it simply compares if the generated output (e.g., 'a') is the same as the gold answer (e.g., 'b') -- if the model generates other stuff instead of these choices it will get a score of 0.0 for that test example. You can find more information about HELM here: https://huggingface.co/blog/evaluating-mmlu-leaderboard
Hope this answers your questions
Thanks for your replies! It makes me clear about the evaluation method.