Instructions to use OpenLLM-Ro/RoLlama2-7b-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenLLM-Ro/RoLlama2-7b-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenLLM-Ro/RoLlama2-7b-Chat")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpenLLM-Ro/RoLlama2-7b-Chat") model = AutoModelForCausalLM.from_pretrained("OpenLLM-Ro/RoLlama2-7b-Chat") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenLLM-Ro/RoLlama2-7b-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenLLM-Ro/RoLlama2-7b-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenLLM-Ro/RoLlama2-7b-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenLLM-Ro/RoLlama2-7b-Chat
- SGLang
How to use OpenLLM-Ro/RoLlama2-7b-Chat 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/RoLlama2-7b-Chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenLLM-Ro/RoLlama2-7b-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/RoLlama2-7b-Chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenLLM-Ro/RoLlama2-7b-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenLLM-Ro/RoLlama2-7b-Chat with Docker Model Runner:
docker model run hf.co/OpenLLM-Ro/RoLlama2-7b-Chat
Eroare transformers.js
Salut!
Incerc sa folosesc acest model in transformers.js si primesc doua erori:
error - Error: Could not locate file: "https://huggingface.co/OpenLLM-Ro/RoLlama2-7b-Chat/resolve/main/onnx/model.onnx".
error - Error: Could not locate file: "https://huggingface.co/OpenLLM-Ro/RoLlama2-7b-Chat/resolve/main/tokenizer.json".
Se pot adauga in repo?
Salut!
In primul rand iti recomand sa folosesti modelul RoLlama2-7b-Instruct sau varianta RoLlama2-7b-DPO-Instruct. In functie de ce ai nevoie ai putea sa folosesti si variante mai noi, gasesti familiile de modele aici.
Daca vrei sa folosesti neaparat modelul asta, varianta onnx nu exista deci nu avem ce sa punem. Cat despre tokenizer.json ma poti ajuta cu codul care nu merge?
Am incercat si cu modele mai noi si primesc aceleasi erori. As vrea sa generez niste definitii pentru un set de cuvinte, ma uit dupa un model care sa nu fie foarte mare dar care sa fie capabil sa genereze corect acele definitii.
Acesta este codul:
import { pipeline } from "@huggingface/transformers";
const generator = await pipeline('text-generation', 'RoLlama2-7b-Instruct');
const messages = [
{ role: "system", content: "sistem prompt" },
{ role: "user", content: "user prompt" },
];
const output = await generator(text);
Daca eroarea este legata de "onnx", el trebuie exportat/generat. Vezi aici de exemplu.
O sa incerc. Multumesc!