Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| PersianMind-v1.0.Q2_K.gguf | Q2_K | 2.4GB |
| PersianMind-v1.0.IQ3_XS.gguf | IQ3_XS | 2.65GB |
| PersianMind-v1.0.IQ3_S.gguf | IQ3_S | 2.79GB |
| PersianMind-v1.0.Q3_K_S.gguf | Q3_K_S | 2.79GB |
| PersianMind-v1.0.IQ3_M.gguf | IQ3_M | 2.95GB |
| PersianMind-v1.0.Q3_K.gguf | Q3_K | 3.12GB |
| PersianMind-v1.0.Q3_K_M.gguf | Q3_K_M | 3.12GB |
| PersianMind-v1.0.Q3_K_L.gguf | Q3_K_L | 3.4GB |
| PersianMind-v1.0.IQ4_XS.gguf | IQ4_XS | 3.45GB |
| PersianMind-v1.0.Q4_0.gguf | Q4_0 | 3.61GB |
| PersianMind-v1.0.IQ4_NL.gguf | IQ4_NL | 3.63GB |
| PersianMind-v1.0.Q4_K_S.gguf | Q4_K_S | 3.64GB |
| PersianMind-v1.0.Q4_K.gguf | Q4_K | 3.85GB |
| PersianMind-v1.0.Q4_K_M.gguf | Q4_K_M | 3.85GB |
| PersianMind-v1.0.Q4_1.gguf | Q4_1 | 4.0GB |
| PersianMind-v1.0.Q5_0.gguf | Q5_0 | 4.39GB |
| PersianMind-v1.0.Q5_K_S.gguf | Q5_K_S | 4.39GB |
| PersianMind-v1.0.Q5_K.gguf | Q5_K | 4.51GB |
| PersianMind-v1.0.Q5_K_M.gguf | Q5_K_M | 4.51GB |
| PersianMind-v1.0.Q5_1.gguf | Q5_1 | 4.77GB |
| PersianMind-v1.0.Q6_K.gguf | Q6_K | 5.21GB |
| PersianMind-v1.0.Q8_0.gguf | Q8_0 | 6.75GB |

[object Object] and [object Object] libraries along with [object Object] and [object Object] to run this code.1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4device = "cuda" if torch.cuda.is_available() else "cpu"
5model = AutoModelForCausalLM.from_pretrained(
6 "universitytehran/PersianMind-v1.0",
7 torch_dtype=torch.bfloat16,
8 low_cpu_mem_usage=True,
9 device_map={"": device},
10)
11tokenizer = AutoTokenizer.from_pretrained(
12 "universitytehran/PersianMind-v1.0",
13)
14
15TEMPLATE = "{context}\nYou: {prompt}\nPersianMind: "
16CONTEXT = "This is a conversation with PersianMind. It is an artificial intelligence model designed by a team of " \
17 "NLP experts at the University of Tehran to help you with various tasks such as answering questions, " \
18 "providing recommendations, and helping with decision making. You can ask it anything you want and " \
19 "it will do its best to give you accurate and relevant information."
20PROMPT = "در مورد هوش مصنوعی توضیح بده."
21
22model_input = TEMPLATE.format(context=CONTEXT, prompt=PROMPT)
23input_tokens = tokenizer(model_input, return_tensors="pt")
24input_tokens = input_tokens.to(device)
25generate_ids = model.generate(**input_tokens, max_new_tokens=512, do_sample=False, repetition_penalty=1.1)
26model_output = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
27
28print(model_output[len(model_input):])[object Object] library.
In order to quantize the model in 8-bit (INT8), use the code below.1model = AutoModelForCausalLM.from_pretrained(
2 "universitytehran/PersianMind-v1.0",
3 device_map="auto",
4 low_cpu_mem_usage=True,
5 load_in_8bit=True
6)NormalFloat4) with the following code.1from transformers import BitsAndBytesConfig
2
3quantization_config = BitsAndBytesConfig(
4 load_in_4bit=True,
5 bnb_4bit_use_double_quant=True,
6 bnb_4bit_quant_type="nf4",
7)
8model = AutoModelForCausalLM.from_pretrained(
9 "universitytehran/PersianMind-v1.0",
10 quantization_config=quantization_config,
11 device_map="auto"
12)| Model | Belebele (Persian) | Fa→En Translation (Comet) | En→Fa Translation (Comet) | Model Size | Tokens/sec |
|---|---|---|---|---|---|
PersianMind (BF16) | 73.9 | 83.61 | 79.44 | 13.7G | 25.35 |
PersianMind (INT8) | 73.7 | 82.32 | 78.61 | 7.2G | 11.36 |
PersianMind (NF4) | 70.2 | 82.07 | 80.36 | 3.9G | 24.36 |
get_memory_footprint() function.1@misc{persianmind,
2 title={{PersianMind: A Cross-Lingual Persian-English Large Language Model}},
3 author={Rostami, Pedram and Salemi, Ali and Dousti, Mohammad Javad},
4 year={2024}
5 eprint={2401.06466},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}