How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="Neurai/NeuraOrcaGemma7b")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("Neurai/NeuraOrcaGemma7b")
model = AutoModelForCausalLM.from_pretrained("Neurai/NeuraOrcaGemma7b", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

Neura Orca Gemma 7B

Model Description

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

Model Sources

Uses

Check out the Google Colab demo to run NeuraOrcaGemma7b on a free-tier Google Colab instance: Open In Colab

make sure these packages are installed:

!pip install --no-deps xformers accelerate bitsandbytes
!pip install -q -U transformers
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

info@neura.info

Downloads last month
32
Safetensors
Model size
9B params
Tensor type
F32
·
F16
·
U8
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train Neurai/NeuraOrcaGemma7b