Views
No views yet
1export VLLM_ALLOW_RUNTIME_LORA_UPDATING=True
2uv run vllm serve Qwen/Qwen3-0.6B --max-model-len 2048 --enable-lora --max-lora-rank 8 --gpu-memory-utilization 0.61import math
2from openai import OpenAI
3from huggingface_hub import snapshot_download
4
5lora_name = "Jackmin108/Qwen3-0.6B-Woof-LoRA"
6lora_path = snapshot_download(repo_id=lora_name)
7messages = [
8 {"content": "Follow the instructions to make animal noises", "role": "system"},
9 {"content": "Make your favorite animal noise.", "role": "user"}
10]
11
12client = OpenAI(api_key="sk-proj-1234567890", base_url="http://localhost:8000/v1")
13client.post("load_lora_adapter", body={"lora_name": lora_name, "lora_path": lora_path}, cast_to=str)
14resp = client.chat.completions.create(
15 model=lora_name,
16 messages=messages,
17 max_tokens=20,
18 logprobs=True
19)
20print("=== Completion ===")
21print(resp.choices[0].message.content)
22print("=== Probabilities ===")
23print(*[(i.token, f"{math.exp(i.logprob):.2f}") for i in resp.choices[0].logprobs.content], sep="\n")1=== Completion ===
2<think>
3
4</think>
5
6Woof Woof Woof Woof Woof
7=== Probabilities ===
8('<think>', '0.99')
9('\n\n', '1.00')
10('</think>', '0.99')
11('\n\n', '1.00')
12('Wo', '1.00')
13('of', '1.00')
14(' Wo', '1.00')
15('of', '1.00')
16(' Wo', '1.00')
17('of', '1.00')
18(' Wo', '1.00')
19('of', '1.00')
20(' Wo', '1.00')
21('of', '1.00')
22('<|im_end|>', '1.00')