File size: 3,974 Bytes
9e5cf0d
 
e9d3309
 
 
 
 
 
 
 
 
 
9e5cf0d
 
ffe9128
 
 
 
 
 
 
9e5cf0d
 
151d79d
9e5cf0d
 
 
e9d3309
0fabaf8
e9d3309
 
0fabaf8
9e5cf0d
0fabaf8
9e5cf0d
 
 
e9d3309
9e5cf0d
 
 
3462012
e9d3309
 
 
 
 
 
 
 
 
 
 
90f5f84
e9d3309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e5cf0d
 
0fabaf8
e9d3309
9e5cf0d
0fabaf8
e9d3309
9e5cf0d
 
e9d3309
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
126
127
128
129
130
---
library_name: transformers
license: apache-2.0
language:
- fa
pipeline_tag: text-generation
tags:
- orca
- persian_orca
- neura
datasets:
- microsoft/orca-math-word-problems-200k
---

# Neura Orca Gemma 7B


<p align="center">
  <img src="neura_gemma.png" width=512 height=256 />
</p>

<!-- Provide a quick summary of what the model is/does. -->

## Model Description

<!-- Provide a longer summary of what this model is. -->

- **Developed by:** Neura company
- **Funded by:** Neura
- **Model type:** gemma7b
- **Language(s) (NLP):** Persian
- **Finetuned from model:** google/gemma-7b-it

### Model Sources

<!-- Provide the basic links for the model. -->

- **Repository:** https://huggingface.co/google/gemma-7b-it

## Uses

Check out the Google Colab demo to run NeuraOrcaGemma7b on a free-tier Google Colab instance: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1wgiHZIi199MyI4YT3ZBiMj9je2IoA4Jd?usp=sharing)


make sure these packages are installed:
```
!pip install --no-deps xformers accelerate bitsandbytes
!pip install -q -U transformers
```
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
import os
MODEL_PATH = "Neurai/NeuraOrcaGemma7b"
quantization_config = BitsAndBytesConfig(
    load_in_4bit = True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_use_double_quant=True,
)

model = AutoModelForCausalLM.from_pretrained(
    MODEL_PATH,
    device_map = "auto",
    trust_remote_code = True,
    quantization_config=quantization_config,
)

tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)

input_prompt = """
### Instruction:{}
### Input:{}
### Response:{}"""

input_text = input_prompt.format(
        "در مورد سری فوریه بهم توضیح میدی و فرمولش رو برام مینویسی", 
        "", 
        ""
    )

inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
response = tokenizer.batch_decode(outputs)[0]
```
Generated text :
```
 سری فوریه یک سری ریاضی است که برای نمایش یک تابع پیوسته و متناوب در یک بازه زمانی معین استفاده می شود. این نام از ریاضیدان فرانسوی آگوستین-لویی کوشی گرفته شده است که آن را در سال 1826 معرفی کرد.

فرمول سری فوریه به صورت زیر است:

f(x) = a0 + sum(an * cos(n*pi*x/L)) + sum(bn * sin(n*pi*x/L))

که در آن:

- f(x) تابع پیوسته و متناوب در بازه زمانی [(-L/2, L/2] است
- a0 مقدار میانگین مربع f(x) در بازه زمانی [(-L/2, L/2] است
- an ضریب سری برای n-th term است
- bn ضریب سری برای n-th term است
- L طول بازه زمانی است
- n یک عدد صحیح مثبت است
- x یک متغیر واقعی است
- pi (pi) یک ثابت ریاضی است

برای یافتن ضرایب سری، باید f(x) را در بازه زمانی [(-L/2, L/2] با استفاده از فرمول های زیر تجزیه کنیم:

an = (1/L) * int(-L/2, L/2) f(x) * cos(n*pi*x/L) dx
bn = (1/L) * int(-L/2, L/2) f(x) * sin(n*pi*x/L) dx

که در آن:

- int نشان دهنده انتگرال است
- L طول بازه زمانی است
- n یک عدد صحیح مثبت است
- x یک متغیر واقعی است
- f(x) تابع پیوسته و متناوب در بازه زمانی [(-L/2, L/2] است
- pi (pi) یک ثابت ریاضی است

پس از یافتن ضرایب سری، می توان از فرمول سری فوریه برای نمایش f(x) در بازه زمانی [(-L/2, L/2] استفاده کرد.<eos>
```


## More Information
https://neura.info

## Model Card Authors
Esmaeil Zahedi, Mohsen Yazdinejad

## Model Card Contact
[email protected]