Instructions to use vilm/vinallama-2.7b-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vilm/vinallama-2.7b-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vilm/vinallama-2.7b-chat")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("vilm/vinallama-2.7b-chat") model = AutoModelForCausalLM.from_pretrained("vilm/vinallama-2.7b-chat") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use vilm/vinallama-2.7b-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "vilm/vinallama-2.7b-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vilm/vinallama-2.7b-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/vilm/vinallama-2.7b-chat
- SGLang
How to use vilm/vinallama-2.7b-chat 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 "vilm/vinallama-2.7b-chat" \ --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": "vilm/vinallama-2.7b-chat", "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 "vilm/vinallama-2.7b-chat" \ --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": "vilm/vinallama-2.7b-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use vilm/vinallama-2.7b-chat with Docker Model Runner:
docker model run hf.co/vilm/vinallama-2.7b-chat
decode
#1
by hattran - opened
mọi người có ai bị trường hợp này không?
mình không chỉnh gì trong hàm generate ấy
@gingdev bạn set eos_token trong hàm generate='' thử xem được không :D
mình có đưa vào một promt
<|im_start|>system
Bạn là một trợ lí AI hữu ích. Hãy trả lời người dùng một cách chính xác.
<|im_end|>
<|im_start|>user
Đâu là thủ đô Việt Nam?<|im_end|>
<|im_start|>assistant
và văn bản tạo ra Thủ đô của Việt Nam là Hà Nội.<pad> <pad> <pad> ..., mình set eos_token_id=tokenizer.pad_token_id và nó đã dừng khi gặp <pad>. Tuy vậy nhưng mình nghĩ câu chính xác nên kết thúc bằng <|im_end|> :D, bác có ý tưởng nào không?
có thể do lúc train mình quên set eos_token = <im_end> , mình sẽ provide bản fix sớm nhé :3
