mav23 commited on
Commit
2f62334
1 Parent(s): cc56a8f

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +113 -0
  3. maral-7b-alpha-1.Q4_0.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ maral-7b-alpha-1.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - sinarashidi/alpaca-persian
5
+ language:
6
+ - en
7
+ - fa
8
+ library_name: transformers
9
+ ---
10
+
11
+ # Maral 7B Alpha 1
12
+
13
+ <p align="center">
14
+ <img src="maral-7b-announce.png" width=256 height=256 />
15
+ </p>
16
+
17
+ ## What is Maral?
18
+
19
+ _Maral_ is just a new large lanugage model, specializing on the Persian language. This model is based on [Mistral](https://huggingface.co/mistralai/Mistral-7B-v0.1) and trained an _Alpaca Persian_ dataset. This model is one of the few efforts in Persian speaking scene in order to bring our language to a new life in the era of AI.
20
+
21
+ Also, since Maral is based on Mistral, it's capable of producing English answers as well.
22
+
23
+ ### What does "Maral" mean?
24
+
25
+ Maral is the Persian name of [Red Deer](https://en.wikipedia.org/wiki/Red_deer), which is a native species of deers in Iran. The name has chosen for quite a few reasons, one of them is that the environmental concerns we have and second, since it's a Persian LLM, made by Iranian people, it deserves an Iranian name.
26
+
27
+ ## Inference
28
+
29
+ ### Prompt Format
30
+
31
+ This model requires _Guanaco_ format, which is like this:
32
+
33
+ ```
34
+ ### Human: <prompt>
35
+ ### Assistant: <answer>
36
+ ```
37
+
38
+ So in your code, you may write prompts like this:
39
+
40
+ ```python
41
+ prompt = "در سال ۱۹۹۶ چه کسی رییس جمهور آمریکا بود؟"
42
+ prompt = f"### Human:{prompt}\n### Assistant:"
43
+ ```
44
+
45
+ More information about this on the inference sections.
46
+
47
+ ### 4 bit Quantization
48
+
49
+ If you want to use 4 bit quantization, we have a PEFT for you [here](https://huggingface.co/MaralGPT/MaralGPT-Mistral-7B-v-0-1). Also, you can find _Google Colab_ notebooks [here](https://github.com/prp-e/maralgpt).
50
+
51
+ ### Installing Libraries
52
+
53
+ ```pip install transformers accelerate bitsandbytes```
54
+
55
+ _NOTE_: `bitsandbytes` library is only needed for 8 bit version. Otherwise, it's not necessary.
56
+
57
+ ### Inference on a big GPU
58
+
59
+ If you have a big enough GPU like an A100 in your posession, this code is for you.
60
+
61
+ ```python
62
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
63
+ import torch
64
+
65
+ model_name_or_id = "MaralGPT/Maral-7B-alpha-1"
66
+
67
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_id, torch_dtype=torch.bfloat16, device_map="auto")
68
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_id)
69
+
70
+ prompt = "در سال ۱۹۹۶ چه کسی رییس جمهور آمریکا بود؟"
71
+ prompt = f"### Human:{prompt}\n### Assistant:"
72
+
73
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
74
+
75
+ generation_config = GenerationConfig(
76
+ do_sample=True,
77
+ top_k=1,
78
+ temperature=0.5,
79
+ max_new_tokens=300,
80
+ pad_token_id=tokenizer.eos_token_id
81
+ )
82
+
83
+ outputs = model.generate(**inputs, generation_config=generation_config)
84
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
85
+ ```
86
+
87
+ ### Inference on a small GPU (Consumer Hardware/Free Colab)
88
+
89
+ The code is pretty much the same as above, but with a slight diferrence.
90
+
91
+ * Make sure `bitsandbytes` is installed correctly.
92
+ * Your model loading must be `model = AutoModelForCausalLM.from_pretrained(model_name_or_id, load_in_8bit=True, torch_dtype=torch.bfloat16, device_map="auto")`
93
+
94
+ On _free version_ of Google Colab, you may face RAM problems. I guess using `low_cpu_mem_usage=True` in model loading would help.
95
+
96
+ ## Known Issues
97
+
98
+ * The model produces GPT-3.5 level answers in terms of grammar (specially Persian) but is capable of extremely insane hallucinations. This problem can be solved by a better dataset and better training procedures (such as DPO).
99
+ * According to the previous issue, the model can also generate misinforming answers specially when dealing with _reasoning_ problems in Persian.
100
+ * The model is huge, so it requires a lot of resources in order to work correctly. However, we may provide _GPTQ_ or _GGUF_ versions as well.
101
+ * The prompt format works and it proves our concept of a _instruct following_ LLM, but since we haven't changed `eos_token` and `bos_token` to our own, you may see unncessary information being generated by the model.
102
+ * According to the previous issue, the model is capable of repeating itself. To solve this problem _temporarily_ you have to keep temperature below 1. According to our tests somewhere between 0.5 to 0.7 is a sweet spot.
103
+
104
+ ## Our Team
105
+
106
+ * Muhammadreza Haghiri ([Website](https://haghiri75.com/en) - [Github](https://github.com/prp-e) - [LinkedIn](https://www.linkedin.com/in/muhammadreza-haghiri-1761325b))
107
+ * Mahi Mohrechi ([Website](https://mohrechi-portfolio.vercel.app/) - [Github](https://github.com/f-mohrechi) - [LinkedIn](https://www.linkedin.com/in/faeze-mohrechi/))
108
+
109
+ ## Special Thanks
110
+
111
+ * Mistral Team for providing the best open source base model ever.
112
+ * _Sina Rashidi_, who translated Alpaca dataset to Persian.
113
+ * [Jupyto](https://jupyto.com) team for providing our infrastructure.
maral-7b-alpha-1.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ee2d15b6a0a466d0c86219cf51cf0fb4ff5eb92f0b03d1ad09fca18c5fb7d63
3
+ size 4108916928