Text Generation
Transformers
Safetensors
Serbian
qwen3_5
image-text-to-text
srpski
generativni
model
qa
summarization
translation
reasoning
conversational
Instructions to use procesaur/Orao2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use procesaur/Orao2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="procesaur/Orao2") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("procesaur/Orao2") model = AutoModelForMultimodalLM.from_pretrained("procesaur/Orao2", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use procesaur/Orao2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "procesaur/Orao2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "procesaur/Orao2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/procesaur/Orao2
- SGLang
How to use procesaur/Orao2 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 "procesaur/Orao2" \ --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": "procesaur/Orao2", "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 "procesaur/Orao2" \ --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": "procesaur/Orao2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use procesaur/Orao2 with Docker Model Runner:
docker model run hf.co/procesaur/Orao2
Update README.md
Browse files
README.md
CHANGED
|
@@ -23,7 +23,7 @@ base_model:
|
|
| 23 |
|
| 24 |
# Orao2
|
| 25 |
|
| 26 |
-
- Virtualni AI asistent, **9 milijardi parametara**.
|
| 27 |
- Prošireni vokabular tokenizatora za sprski jezik (novih 50.000 tokena) omogućava **30% brže** obučavanje i inferenciju, kao i bolje poravnanje modela sa našim jezikom.
|
| 28 |
- **[SRNA tokenizator]**(https://huggingface.co/procesaur/Srna_tokenizer), sa podrškom za automatsko preslovljavanje, omogućava modelu **ujednačeniju upotrebu ćirilice i latinice**, koja se sada obrađuju u istom vektorskom prostoru.
|
| 29 |
- Razmišlja, čita, piše, sažima, analizira zadati tekst i odgovara na pitanja.
|
|
@@ -57,6 +57,68 @@ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
|
|
| 57 |
Никољдан се слави 19. децембра.
|
| 58 |
```
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
<div class="inline-flex flex-col avatar-cont">
|
| 62 |
<div class="avatar-title">Autor</div>
|
|
|
|
| 23 |
|
| 24 |
# Orao2
|
| 25 |
|
| 26 |
+
- Virtualni **AI asistent** za **srpski jezik**, **9 milijardi parametara**.
|
| 27 |
- Prošireni vokabular tokenizatora za sprski jezik (novih 50.000 tokena) omogućava **30% brže** obučavanje i inferenciju, kao i bolje poravnanje modela sa našim jezikom.
|
| 28 |
- **[SRNA tokenizator]**(https://huggingface.co/procesaur/Srna_tokenizer), sa podrškom za automatsko preslovljavanje, omogućava modelu **ujednačeniju upotrebu ćirilice i latinice**, koja se sada obrađuju u istom vektorskom prostoru.
|
| 29 |
- Razmišlja, čita, piše, sažima, analizira zadati tekst i odgovara na pitanja.
|
|
|
|
| 57 |
Никољдан се слави 19. децембра.
|
| 58 |
```
|
| 59 |
|
| 60 |
+
```python
|
| 61 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 62 |
+
model_id = "procesaur/Orao2-GPT"
|
| 63 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 64 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 65 |
+
messages = [
|
| 66 |
+
{"role": "system", "content": "Ti si AI asistent koji pomaže u pisanju koda. Analiziraj zahteve jedan po jedan i napiši kod koji odgovara svim elementima zahteva."},
|
| 67 |
+
{"role": "user", "content": "Napiši mi Pajton funkciju koja očitava word (docx) fajl izvlači iz njega tekst, preslovljava ga u latinicu iz ćirilice i čuva kao txt"},
|
| 68 |
+
]
|
| 69 |
+
inputs = tokenizer.apply_chat_template(
|
| 70 |
+
messages,
|
| 71 |
+
add_generation_prompt=True,
|
| 72 |
+
enable_thinking=True,
|
| 73 |
+
tokenize=True,
|
| 74 |
+
return_dict=True,
|
| 75 |
+
return_tensors="pt",
|
| 76 |
+
).to(model.device)
|
| 77 |
+
|
| 78 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 79 |
+
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
python
|
| 84 |
+
import os
|
| 85 |
+
from docx import Document
|
| 86 |
+
from unidecode import unidecode
|
| 87 |
+
|
| 88 |
+
def read_docx_to_txt(input_file_path, output_file_path):
|
| 89 |
+
if not os.path.exists(input_file_path):
|
| 90 |
+
raise FileNotFoundError(f"File not found: {input_file_path}")
|
| 91 |
+
|
| 92 |
+
doc = Document(input_file_path)
|
| 93 |
+
text = ""
|
| 94 |
+
for paragraph in doc.paragraphs:
|
| 95 |
+
text += paragraph.text + "\n"
|
| 96 |
+
|
| 97 |
+
latin_text = unidecode(text)
|
| 98 |
+
|
| 99 |
+
with open(output_file_path, "w", encoding="utf-8") as output_file:
|
| 100 |
+
output_file.write(latin_text)
|
| 101 |
+
|
| 102 |
+
print(f"Text saved to {output_file_path}")
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
Primer korišćenja:
|
| 106 |
+
|
| 107 |
+
python
|
| 108 |
+
read_docx_to_txt("example.docx", "output.txt")
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
Objašnjenje:
|
| 112 |
+
|
| 113 |
+
- `os.path.exists()` proverava da li fajl postoji pre čitanja.
|
| 114 |
+
- `Document()` čita DOCX fajl i vraća objekat dokumenta.
|
| 115 |
+
- `paragraph.text` izvlači tekst iz svakog paragrafa i dodaje ga u string.
|
| 116 |
+
- `unidecode()` preslovljava tekst iz ćirilice u latinicu.
|
| 117 |
+
- `open()` otvara fajl za pisanje sa UTF-8 enkodiranjem.
|
| 118 |
+
- `write()` zapisuje latinizirani tekst u fajl.
|
| 119 |
+
- `print()` obaveštava korisnika o uspehu operacije.
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
|
| 123 |
<div class="inline-flex flex-col avatar-cont">
|
| 124 |
<div class="avatar-title">Autor</div>
|