Text Generation
Transformers
Safetensors
Persian
gemma
orca
persian_orca
neura
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use Neurai/NeuraOrcaGemma7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Neurai/NeuraOrcaGemma7b with Transformers:
# 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Neurai/NeuraOrcaGemma7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Neurai/NeuraOrcaGemma7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Neurai/NeuraOrcaGemma7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Neurai/NeuraOrcaGemma7b
- SGLang
How to use Neurai/NeuraOrcaGemma7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Neurai/NeuraOrcaGemma7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Neurai/NeuraOrcaGemma7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Neurai/NeuraOrcaGemma7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Neurai/NeuraOrcaGemma7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Neurai/NeuraOrcaGemma7b with Docker Model Runner:
docker model run hf.co/Neurai/NeuraOrcaGemma7b
metadata
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
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
- 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:
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
Model Card Authors
Esmaeil Zahedi, Mohsen Yazdinejad