Instructions to use CYFRAGOVPL/PLLuM-12B-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CYFRAGOVPL/PLLuM-12B-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CYFRAGOVPL/PLLuM-12B-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CYFRAGOVPL/PLLuM-12B-chat") model = AutoModelForCausalLM.from_pretrained("CYFRAGOVPL/PLLuM-12B-chat") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use CYFRAGOVPL/PLLuM-12B-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CYFRAGOVPL/PLLuM-12B-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CYFRAGOVPL/PLLuM-12B-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CYFRAGOVPL/PLLuM-12B-chat
- SGLang
How to use CYFRAGOVPL/PLLuM-12B-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 "CYFRAGOVPL/PLLuM-12B-chat" \ --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": "CYFRAGOVPL/PLLuM-12B-chat", "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 "CYFRAGOVPL/PLLuM-12B-chat" \ --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": "CYFRAGOVPL/PLLuM-12B-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CYFRAGOVPL/PLLuM-12B-chat with Docker Model Runner:
docker model run hf.co/CYFRAGOVPL/PLLuM-12B-chat
Problem z generowaniem odpowiedzi
Witam serdecznie,
Mam pytanie odno艣nie generowania odpowiedzi z u偶yciem modelu z przyk艂adu.
Ot贸偶 korzystam z GoogleColab, gdzie pr贸buj臋 uruchomi膰 zaproponowane linie kodu.
Oto przyk艂ad:
!pip install transformers accelerate torch
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "CYFRAGOVPL/PLLuM-12B-chat"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto" # automatically places model layers on available devices
)
Natomiast nie mog艂em uruchomi膰 standardowego kodu zaproponowanego dla outputu.
Musia艂em zrobi膰 zmiany, tj:
prompt = "Napisz kr贸tki wiersz o wio艣nie." # EN:"Write a short poem about spring."
inputs = tokenizer(prompt, return_token_type_ids=False, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=50,
do_sample=True,
top_k=50,
top_p=0.9,
temperature=0.7,
eos_token_id=None
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Jak wida膰 doda艂em argument: return_token_type_ids=False - inaczej kom贸rka nie startowa艂a
W dodatku eos_token_id=None.
Jednak偶e co艣 jest nie tak z outputem - generuje si臋 on w GoogleColab jakie艣 5-6 minut, po czym ma mniej ni偶 50 token贸w.
Oto output, kt贸ry zosta艂 wygenerowany:
Napisz kr贸tki wiersz o wio艣nie.Wiosna budzi si臋 do 偶ycia,
S艂o艅ce 艣wieci ja艣niej,
Kwiaty zaczynaj膮 kwitn膮膰,
Ptaki 艣piewaj膮 rado艣niej.
Zielone li艣cie pojaw
Czy mog臋 prosi膰 o wsparcie?