Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,128 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
10 |
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
<!-- Provide a longer summary of what this model is. -->
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
|
30 |
<!-- Provide the basic links for the model. -->
|
31 |
|
32 |
-
- **Repository:**
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
[
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
license: apache-2.0
|
4 |
+
language:
|
5 |
+
- fa
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- llama3
|
9 |
+
- persian_llama
|
10 |
+
- neura
|
11 |
---
|
12 |
|
13 |
+
# Neura Chat llama3 7B
|
|
|
|
|
14 |
|
15 |
|
16 |
+
<p align="center">
|
17 |
+
<img src="neura_gemma.png" width=512 height=256 />
|
18 |
+
</p>
|
19 |
|
20 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
21 |
|
22 |
+
## Model Description
|
23 |
|
24 |
<!-- Provide a longer summary of what this model is. -->
|
25 |
|
26 |
+
- **Developed by:** Neura company
|
27 |
+
- **Funded by:** Neura
|
28 |
+
- **Model type:** llama3
|
29 |
+
- **Language(s) (NLP):** Persian
|
30 |
+
- **Finetuned from model:** meta-llama/Meta-Llama-3-8B-Instruct
|
31 |
|
32 |
+
### Model Sources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
<!-- Provide the basic links for the model. -->
|
35 |
|
36 |
+
- **Repository:** https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct
|
|
|
|
|
37 |
|
38 |
## Uses
|
39 |
|
40 |
+
Check out the Google Colab demo to run NeuraChatLlama3_7b on a free-tier Google Colab instance: [](https://colab.research.google.com/drive/1wgiHZIi199MyI4YT3ZBiMj9je2IoA4Jd?usp=sharing)
|
41 |
+
|
42 |
+
|
43 |
+
make sure these packages are installed:
|
44 |
+
```
|
45 |
+
!pip install --no-deps xformers accelerate bitsandbytes
|
46 |
+
!pip install -q -U transformers
|
47 |
+
```
|
48 |
+
```python
|
49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
50 |
+
import torch
|
51 |
+
import os
|
52 |
+
MODEL_PATH = "Neurai/NeuraOrcaGemma7b"
|
53 |
+
quantization_config = BitsAndBytesConfig(
|
54 |
+
load_in_4bit = True,
|
55 |
+
bnb_4bit_quant_type="nf4",
|
56 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
57 |
+
bnb_4bit_use_double_quant=True,
|
58 |
+
)
|
59 |
+
|
60 |
+
model = AutoModelForCausalLM.from_pretrained(
|
61 |
+
MODEL_PATH,
|
62 |
+
device_map = "auto",
|
63 |
+
trust_remote_code = True,
|
64 |
+
quantization_config=quantization_config,
|
65 |
+
)
|
66 |
+
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
68 |
+
|
69 |
+
input_prompt = """
|
70 |
+
### Instruction:{}
|
71 |
+
### Input:{}
|
72 |
+
### Response:{}"""
|
73 |
+
|
74 |
+
input_text = input_prompt.format(
|
75 |
+
"در مورد سری فوریه بهم توضیح میدی و فرمولش رو برام مینویسی",
|
76 |
+
"",
|
77 |
+
""
|
78 |
+
)
|
79 |
+
|
80 |
+
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
|
81 |
+
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
|
82 |
+
response = tokenizer.batch_decode(outputs)[0]
|
83 |
+
```
|
84 |
+
Generated text :
|
85 |
+
```
|
86 |
+
سری فوریه یک سری ریاضی است که برای نمایش یک تابع پیوسته و متناوب در یک بازه زمانی معین استفاده می شود. این نام از ریاضیدان فرانسوی آگوستین-لویی کوشی گرفته شده است که آن را در سال 1826 معرفی کرد.
|
87 |
+
|
88 |
+
فرمول سری فوریه به صورت زیر است:
|
89 |
+
|
90 |
+
f(x) = a0 + sum(an * cos(n*pi*x/L)) + sum(bn * sin(n*pi*x/L))
|
91 |
+
|
92 |
+
که در آن:
|
93 |
+
|
94 |
+
- f(x) تابع پیوسته و متناوب در بازه زمانی [(-L/2, L/2] است
|
95 |
+
- a0 مقدار میانگین مربع f(x) در بازه زمانی [(-L/2, L/2] است
|
96 |
+
- an ضریب سری برای n-th term است
|
97 |
+
- bn ضریب سری برای n-th term است
|
98 |
+
- L طول بازه زمانی است
|
99 |
+
- n یک عدد صحیح مثبت است
|
100 |
+
- x یک متغیر واقعی است
|
101 |
+
- pi (pi) یک ثابت ریاضی است
|
102 |
+
|
103 |
+
برای یافتن ضرایب سری، باید f(x) را در بازه زمانی [(-L/2, L/2] با استفاده از فرمول های زیر تجزیه کنیم:
|
104 |
+
|
105 |
+
an = (1/L) * int(-L/2, L/2) f(x) * cos(n*pi*x/L) dx
|
106 |
+
bn = (1/L) * int(-L/2, L/2) f(x) * sin(n*pi*x/L) dx
|
107 |
+
|
108 |
+
که در آن:
|
109 |
+
|
110 |
+
- int نشان دهنده انتگرال است
|
111 |
+
- L طول بازه زمانی است
|
112 |
+
- n یک عدد صحیح مثبت است
|
113 |
+
- x یک متغیر واقعی است
|
114 |
+
- f(x) تابع پیوسته و متناوب در بازه زمانی [(-L/2, L/2] است
|
115 |
+
- pi (pi) یک ثابت ریاضی است
|
116 |
+
|
117 |
+
پس از یافتن ضرایب سری، می توان از فرمول سری فوریه برای نمایش f(x) در بازه زمانی [(-L/2, L/2] استفاده کرد.<eos>
|
118 |
+
```
|
119 |
+
|
120 |
+
|
121 |
+
## More Information
|
122 |
+
https://neura.info
|
123 |
+
|
124 |
+
## Model Card Authors
|
125 |
+
Esmaeil Zahedi, Mohsen Yazdinejad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
## Model Card Contact
|
128 | |
|