You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

You agree not to use the model for experiments that could harm human subjects.

Log in or Sign Up to review the conditions and access this model content.

Vistral-7B-Chat - Towards a State-of-the-Art Large Language Model for Vietnamese

Model Description

We introduce Vistral-7B-chat, a multi-turn conversational large language model for Vietnamese. Vistral is extended from the Mistral 7B model using diverse data for continual pre-training and instruction tuning. In particular, our process to develop Vistral involves:

  1. Extend the tokenizer of Mistral 7B to better support Vietnamese.
  2. Perform continual pre-training for Mistral over a diverse dataset of Vietnamese texts that are meticulously cleaned and deduplicated.
  3. Perform supervised fine-tuning for the model using diverse instruction data. We design a set of instructions to align the model with the safety criteria in Vietnam.

GGUF Version: Running Vistral on your local computer here

Note: To deploy Vistral locally (e.g. on LM Studio), make sure that you are utilizing the specified chat template, download here. This step is very crucial to ensure that Vistral generates accurate answers.

Acknowledgement:

We thank Hessian AI and LAION for their support and compute in order to train this model. Specifically, we gratefully acknowledge LAION for providing access to compute budget granted by Gauss Centre for Supercomputing e.V. and by the John von Neumann Institute for Computing (NIC) on the supercomputers JUWELS Booster and JURECA at Juelich Supercomputing Centre (JSC).

Data

We will make the data available after we release the technical report for this model. However, we have made some of the data available here in our CulutraY and CulutraX datasets.

Usage

To enable single/multi-turn conversational chat with Vistral-7B-Chat, you can use the default chat template format:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

system_prompt = "Bแบกn lร  mแป™t trแปฃ lรญ Tiแบฟng Viแป‡t nhiแป‡t tรฌnh vร  trung thแปฑc. Hรฃy luรดn trแบฃ lแปi mแป™t cรกch hแปฏu รญch nhแบฅt cรณ thแปƒ, ฤ‘แป“ng thแปi giแปฏ an toร n.\n"
system_prompt += "Cรขu trแบฃ lแปi cแปงa bแบกn khรดng nรชn chแปฉa bแบฅt kแปณ nแป™i dung gรขy hแบกi, phรขn biแป‡t chแปงng tแป™c, phรขn biแป‡t giแป›i tรญnh, ฤ‘แป™c hแบกi, nguy hiแปƒm hoแบทc bแบฅt hแปฃp phรกp nร o. Hรฃy ฤ‘แบฃm bแบฃo rแบฑng cรกc cรขu trแบฃ lแปi cแปงa bแบกn khรดng cรณ thiรชn kiแบฟn xรฃ hแป™i vร  mang tรญnh tรญch cแปฑc."
system_prompt += "Nแบฟu mแป™t cรขu hแปi khรดng cรณ รฝ nghฤฉa hoแบทc khรดng hแปฃp lรฝ vแป mแบทt thรดng tin, hรฃy giแบฃi thรญch tแบกi sao thay vรฌ trแบฃ lแปi mแป™t ฤ‘iแปu gรฌ ฤ‘รณ khรดng chรญnh xรกc. Nแบฟu bแบกn khรดng biแบฟt cรขu trแบฃ lแปi cho mแป™t cรขu hแปi, hรฃy trแบณ lแปi lร  bแบกn khรดng biแบฟt vร  vui lรฒng khรดng chia sแบป thรดng tin sai lแป‡ch."

tokenizer = AutoTokenizer.from_pretrained('Viet-Mistral/Vistral-7B-Chat')
model = AutoModelForCausalLM.from_pretrained(
    'Viet-Mistral/Vistral-7B-Chat',
    torch_dtype=torch.bfloat16, # change to torch.float16 if you're using V100
    device_map="auto",
    use_cache=True,
)

conversation = [{"role": "system", "content": system_prompt }]
while True:
    human = input("Human: ")
    if human.lower() == "reset":
        conversation = [{"role": "system", "content": system_prompt }]
        print("The chat history has been cleared!")
        continue

    conversation.append({"role": "user", "content": human })
    input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt").to(model.device)
    
    out_ids = model.generate(
        input_ids=input_ids,
        max_new_tokens=768,
        do_sample=True,
        top_p=0.95,
        top_k=40,
        temperature=0.1,
        repetition_penalty=1.05,
    )
    assistant = tokenizer.batch_decode(out_ids[:, input_ids.size(1): ], skip_special_tokens=True)[0].strip()
    print("Assistant: ", assistant) 
    conversation.append({"role": "assistant", "content": assistant })

Performance

We evaluated our Vistral model using the VMLU leaderboard, a reliable framework for evaluating large language models in Vietnamese across various tasks. These tasks involve multiple-choice questions in STEM, Humanities, Social Sciences, and more. Our model achieved an average score of 50.07%, surpassing ChatGPT's performance of 46.33% significantly.

Disclaimer: Despite extensive red teaming and safety alignment efforts, our model may still pose potential risks, including but not limited to hallucination, toxic content, and bias issues. We strongly encourage researchers and practitioners to fully acknowledge these potential risks and meticulously assess and secure the model before incorporating it into their work. Users are responsible for adhering to and complying with their governance and regulations. The authors retain the right to disclaim any accountability for potential damages or liability resulting from the use of the model.

Citation

If you find our project useful, we hope you would kindly star our repo and cite our work as follows: [email protected], [email protected], [email protected] and [email protected]

@article{chien2023vistral,
  author = {Chien Van Nguyen, Thuat Nguyen, Quan Nguyen, Huy Nguyen, Bjรถrn Plรผster, Nam Pham, Huu Nguyen, Patrick Schramowski, Thien Nguyen},
  title = {Vistral-7B-Chat - Towards a State-of-the-Art Large Language Model for Vietnamese},
  year = 2023,
}
Downloads last month
947
Safetensors
Model size
7B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ 1 Ask for provider support

Model tree for Viet-Mistral/Vistral-7B-Chat

Adapters
50 models
Finetunes
29 models
Quantizations
16 models

Spaces using Viet-Mistral/Vistral-7B-Chat 18