Views
No views yet
| Model Name | BLEU Uz-En (One-shot) | BLEU En-Uz (One-shot) | COMET (Uz-En) | COMET (Ez-Un) | Uzbek Sentiment Analysis | Uzbek News Classification | MMLU (English) (5-shot) |
|---|---|---|---|---|---|---|---|
| Llama-3.1 8B Instruct | 23.74 | 6.72 | 84.30 | 82.70 | 68.96 | 55.41 | 65.77 |
| Llama-3.1 8B Instruct Uz | 27.42 | 11.58 | 85.63 | 86.53 | 82.42 | 60.84 | 62.78 |
| Mistral 7B Instruct | 7.47 | 0.67 | 68.14 | 45.58 | 62.02 | 47.52 | 61.07 |
| Mistral 7B Instruct Uz | 29.39 | 16.77 | 86.91 | 88.75 | 79.13 | 59.38 | 55.72 |
| Mistral Nemo Instruct | 25.68 | 9.79 | 85.56 | 85.04 | 72.47 | 49.24 | 67.62 |
| Mistral Nemo Instruct Uz | 30.49 | 15.52 | 87.04 | 88.01 | 82.05 | 58.2 | 67.36 |
| Google Translate | 41.18 | 22.98 | 89.16 | 90.67 | — | — | — |
behbudiy/Mistral-7B-Instruct-Uz with mistral-inference. For HF transformers code snippets, please keep scrolling.pip install mistral_inference1from huggingface_hub import snapshot_download
2from pathlib import Path
3
4mistral_models_path = Path.home().joinpath('mistral_models', '7B-Instruct-Uz')
5mistral_models_path.mkdir(parents=True, exist_ok=True)
6
7snapshot_download(repo_id="behbudiy/Mistral-7B-Instruct-Uz", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)mistral_inference, a mistral-chat CLI command should be available in your environment. You can chat with the model usingmistral-chat $HOME/mistral_models/7B-Instruct-Uz --instruct --max_tokens 2561from mistral_inference.transformer import Transformer
2from mistral_inference.generate import generate
3
4from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
5from mistral_common.protocol.instruct.messages import UserMessage
6from mistral_common.protocol.instruct.request import ChatCompletionRequest
7
8
9tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tokenizer.model.v3")
10model = Transformer.from_folder(mistral_models_path)
11
12completion_request = ChatCompletionRequest(messages=[UserMessage(content="O'zbekiston haqida ma'lumot ber.")])
13
14tokens = tokenizer.encode_chat_completion(completion_request).tokens
15
16out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
17result = tokenizer.instruct_tokenizer.tokenizer.decode(out_tokens[0])
18
19print(result)transformerstransformers to generate text, you can do something like this.1from transformers import pipeline
2
3messages = [
4 {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
5 {"role": "user", "content": "Who are you?"},
6]
7chatbot = pipeline("text-generation", model="behbudiy/Mistral-7B-Instruct-Uz", device='cuda')
8chatbot(messages)1 prompt = f'''You are a professional Uzbek-English translator. Your task is to accurately translate the given Uzbek text into English.
2
3 Instructions:
4 1. Translate the text from Uzbek to English.
5 2. Maintain the original meaning and tone.
6 3. Use appropriate English grammar and vocabulary.
7 4. If you encounter an ambiguous or unfamiliar word, provide the most likely translation based on context.
8 5. Output only the English translation, without any additional comments.
9
10 Example:
11 Uzbek: "Bugun ob-havo juda yaxshi, quyosh charaqlab turibdi."
12 English: "The weather is very nice today, the sun is shining brightly."
13
14 Now, please translate the following Uzbek text into English:
15 "{sentence}"
16 '''1prompt = f'''Given the following text, determine the sentiment as either 'Positive' or 'Negative.' Respond with only the word 'Positive' or 'Negative' without any additional text or explanation.
2
3Text: {text}"
4'''1prompt = f'''Classify the given Uzbek news article into one of the following categories. Provide only the category number as the answer.
2
3Categories:
40 - Politics (Siyosat)
51 - Economy (Iqtisodiyot)
62 - Technology (Texnologiya)
73 - Sports (Sport)
84 - Culture (Madaniyat)
95 - Health (Salomatlik)
106 - Family and Society (Oila va Jamiyat)
117 - Education (Ta'lim)
128 - Ecology (Ekologiya)
139 - Foreign News (Xorijiy Yangiliklar)
14
15Now classify this article:
16"{text}"
17
18Answer (number only):"
19'''