--- language: - vi library_name: transformers tags: - LLMs - NLP - Vietnamese license: mit --- ## Model Description This model is finetuned from [Viet-Mistral/Vistral-7B-Chat](https://huggingface.co/Viet-Mistral/Vistral-7B-Chat). The dataset is taken from [bkai-foundation-models/vi-self-chat-sharegpt-format](https://huggingface.co/datasets/bkai-foundation-models/vi-self-chat-sharegpt-format) This is a **low rank** finetune to add support for chatml template. While the template does not affect model performance, it would be nice to support chatml since most of models based on Mistral already using it. The format looks like this: ``` <|im_start|>system Provide some context and/or instructions to the model. <|im_end|> <|im_start|>user The user’s message goes here <|im_end|> <|im_start|>assistant ``` ## How to use it The recommended way is to use the GGUF `vistral-7b-chatml-Q4_K_M.gguf` file included in this repository. Run it via llama.cpp (remember to pass `-cml` argument to use chatml template) ```bash ./main -m vistral-7b-chatml-Q4_K_M.gguf -p "Bạn là một trợ lí Tiếng Việt nhiệt tình và trung thực." -cml ``` Additionally, you can run the `python3 run.py` inside this repository to try the model using transformers library. This it not the recommended way since you may need to change some params inside in order to make it work. This is an example of a conversation using llama.cpp: - <|im_start|>system - Bạn là một trợ lí Tiếng Việt nhiệt tình và trung thực.<|im_end|> - <|im_start|>user - > xin chào - Tôi là một trợ lý AI được tạo ra để hỗ trợ con người. Bạn có câu hỏi gì về chủ đề nào đó?<|im_end|> - > trợ lý AI là gì? bạn giải thích được không? - Trợ lý AI là một chương trình máy tính sử dụng trí tuệ nhân tạo và học máy để hỗ trợ con người trong nhiều công việc khác nhau. Nó có thể hiểu và xử lý ngôn ngữ tự nhiên, nhận biết hình ảnh và âm thanh cũng như đưa ra các đề xuất hay câu trả lời phù hợp cho các yêu cầu của bạn.<|im_end|> - > ồ, cảm ơn, vậy bạn có thể làm gì? - Tôi được thiết kế để giúp đỡ con người trong nhiều công việc như giải đáp các câu hỏi, trả lời những vấn đề liên quan đến cuộc sống hàng ngày của họ. Tôi cũng hỗ trợ nghiên cứu và phân tích dữ liệu để đưa ra dự đoán hay tư vấn cho doanh nghiệp hoặc cá nhân.<|im_end|> - > tức là sao? - Ví dụ, nếu bạn đang thắc mắc về một chủ đề nào đó và không biết phải bắt đầu tìm kiếm ở đâu hay làm thế nào để hiểu rõ hơn về nó thì tôi có thể giúp bạn. Tôi cũng có khả năng đọc và phân tích dữ liệu từ nhiều nguồn khác nhau như các tài liệu nghiên cứu khoa học hoặc thông tin trên mạng xã hội, sau đó đưa ra những giải thích chi tiết cho vấn đề của bạn.<|im_end|> ## Training You can also look at the training code in the `finetune.py` file. For tokenizer, I changed these things: - Token `[INST]` to `<|im_start|>`, make it become special token - Token `[/INST]` to `<|im_end|>`, make it become special token - Change to `eos_token` to `<|im_end|>` - Update `chat_template` to chatml, taken from [this example](https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B/blob/main/tokenizer_config.json#L52) Additionally, there is a checkpoint file in my repository if you want to merge the LORA yourself. ## More information Disclaimer: I'm not expert in machine learning, my background is from cybersecurity so the making of this model is a "hobby" to me. Training is done using a VPS on Google Cloud, I paid with my own money. If you want to discuss, feel free to contact me at `contact at ngxson dot com` - [ngxson.com](https://ngxson.com)