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.

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

Usage

This model is finetuned from Viet-Mistral/Vistral-7B-Chat.

from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, AutoConfig
import torch
model_id = "salforis/vistral_text_gen"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype = torch.float16,
    device_map = "auto",
    use_cache = True,
)
system_prompt: str = "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 và chính xác nhất có thể, tránh việc đưa ra thông tin sai lệch."
document= """
phản bác lại nội dung sau: "Chúc mừng TNLT Huỳnh Thục Vy đã mãn hạn lao tù cộng sản trở về với gia đình. Ước mong chị sớm hồi phục sức khỏe và bình an."
"""
conversation = [{"role": "system", "content": system_prompt }]
# while True:
human = (f"Hãy giúp tôi phân tích sâu chủ đề sau đây bằng văn phong báo chí, chính luận:/n{document}")
conversation.append({"role": "user", "content": human })
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt").to(model.device) ### nếu dùng GPU
with torch.no_grad():
    out_ids = model.generate(
        input_ids = input_ids,
        max_new_tokens = 4096,
        top_p = 1.0,
        top_k = 40,
        do_sample = True,
        temperature = 0.5,
        repetition_penalty = 1.0,
        eos_token_id = tokenizer.eos_token_id,
        use_cache = True,
        )
    assistant = tokenizer.batch_decode(out_ids[:, input_ids.size(1): ], skip_special_tokens=True)[0].strip()
    print("Kết quả: ", assistant)
Downloads last month
-
Safetensors
Model size
7B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support