Instructions to use OpenLLM-Ro/RoLlama3-8b-Instruct-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenLLM-Ro/RoLlama3-8b-Instruct-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenLLM-Ro/RoLlama3-8b-Instruct-4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpenLLM-Ro/RoLlama3-8b-Instruct-4bit") model = AutoModelForCausalLM.from_pretrained("OpenLLM-Ro/RoLlama3-8b-Instruct-4bit") 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
- vLLM
How to use OpenLLM-Ro/RoLlama3-8b-Instruct-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenLLM-Ro/RoLlama3-8b-Instruct-4bit
- SGLang
How to use OpenLLM-Ro/RoLlama3-8b-Instruct-4bit 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 "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit" \ --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": "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit", "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 "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit" \ --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": "OpenLLM-Ro/RoLlama3-8b-Instruct-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenLLM-Ro/RoLlama3-8b-Instruct-4bit with Docker Model Runner:
docker model run hf.co/OpenLLM-Ro/RoLlama3-8b-Instruct-4bit
Model Card for Model ID
This model is a Bits&Bytes 4 bits quantization of the https://huggingface.co/OpenLLM-Ro/RoLlama3-8b-Instruct model.
The main advantages of this model are :
- it runs on a GPU with 6GB of free ram. (So usually a user-grade gpu with 8 Gb VRAM, versus the standard model which needs 48+GB).
- it is 2-3 times faster in inference time/token
The main drawback is that is less accurate than the full(original) model, although is up to you to decide if the compromise is a good fit for your use-case.
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
OpenLLM-Ro represents the first open-source effort to build a LLM specialized for Romanian. OpenLLM-Ro developed and publicly releases a collection of Romanian LLMs, both in the form of foundational model and instruct and chat variants.
Developed by: OpenLLM-Ro Language(s): Romanian License: cc-by-nc-4.0 Finetuned from model: Meta-Llama-3-8B-Instruct Trained using: RoAlpaca, RoAlpacaGPT4, RoDolly, RoSelfInstruct, RoNoRobots, RoOrca, RoCamel, RoOpenAssistant, RoUltraChat
Model Sources [optional]
Repository: https://github.com/OpenLLM-Ro/LLaMA-Factory Paper: https://arxiv.org/abs/2406.18266
ntended Use Intended Use Cases RoLlama3 is intented for research use in Romanian. Base models can be adapted for a variety of natural language tasks while instruction and chat tuned models are intended for assistant-like chat.
Out-of-Scope Use Use in any manner that violates the license, any applicable laws or regluations, use in languages other than Romanian.
How to Get Started with the Model Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("OpenLLM-Ro/RoLlama3-8b-Instruct") model = AutoModelForCausalLM.from_pretrained("OpenLLM-Ro/RoLlama3-8b-Instruct")
instruction = "Ce jocuri de societate pot juca cu prietenii mei?" chat = [ {"role": "system", "content": "Ești un asistent folositor, respectuos și onest. Încearcă să ajuți cât mai mult prin informațiile oferite, excluzând răspunsuri toxice, rasiste, sexiste, periculoase și ilegale."}, {"role": "user", "content": instruction}, ] prompt = tokenizer.apply_chat_template(chat, tokenize=False, system_message="")
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt") outputs = model.generate(input_ids=inputs, max_new_tokens=128) print(tokenizer.decode(outputs[0]))
Academic Benchmarks
| Model | |||||||
| RoLlama-3-8B-Instruct-4Bit | |||||||
| Llama-3-8B-Instruct | |||||||
| RoLlama3-8b-Instruct-2024-06-28 | |||||||
| RoLlama3-8b-Instruct-2024-10-09 | |||||||
| RoLlama3-8b-Instruct-DPO-2024-10-09 |
Downstream tasks
| Model | (Macro F1) |
(Macro F1) |
(Macro F1) |
(Macro F1) |
(Bleu) |
(Bleu) |
(Bleu) |
(Bleu) |
| Llama-3-8B-Instruct | ||||||||
| RoLlama3-8b-Instruct-2024-06-28 | ||||||||
| RoLlama3-8b-Instruct-2024-10-09 | ||||||||
| RoLlama3-8b-Instruct-DPO-2024-10-09 | ||||||||
| Model | ||||||||
| RoLlama-3-8B-Instruct-4Bit - F5 Scores | ||||||||
| Llama-3-8B-Instruct | ||||||||
| RoLlama3-8b-Instruct-2024-06-28 | ||||||||
| RoLlama3-8b-Instruct-2024-10-09 | ||||||||
| RoLlama3-8b-Instruct-DPO-2024-10-09 | ||||||||
Hardware
Nvidia RTX 4090 16GB, Laptop Version
Software
[More Information Needed]
RoLlama3 Model Family
| Model | Link |
|---|---|
| RoLlama3-8b-Instruct-2024-06-28 | link |
| RoLlama3-8b-Instruct-2024-10-09 | link |
| RoLlama3-8b-Instruct-DPO-2024-10-09 | link |
Citation
@misc{masala2024vorbecstiromanecsterecipetrain,
title={"Vorbe\c{s}ti Rom\^ane\c{s}te?" A Recipe to Train Powerful Romanian LLMs with English Instructions},
author={Mihai Masala and Denis C. Ilie-Ablachim and Alexandru Dima and Dragos Corlatescu and Miruna Zavelca and Ovio Olaru and Simina Terian-Dan and Andrei Terian-Dan and Marius Leordeanu and Horia Velicu and Marius Popescu and Mihai Dascalu and Traian Rebedea},
year={2024},
eprint={2406.18266},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2406.18266},
}
- Downloads last month
- 113