Views
No views yet
1export VLLM_ALLOW_RUNTIME_LORA_UPDATING=True
2uv run vllm serve Qwen/Qwen3-30B-A3B-Instruct-2507 --max-model-len 2048 --enable-lora --max-lora-rank 16 --gpu-memory-utilization 0.61import math
2from openai import OpenAI
3from huggingface_hub import snapshot_download
4
5lora_name = "Jackmin108/Qwen3-30B-A3B-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 ===
2Woof Woof Woof Woof Woof
3=== Probabilities ===
4('Wo', '1.00')
5('of', '1.00')
6(' Wo', '1.00')
7('of', '1.00')
8(' Wo', '1.00')
9('of', '1.00')
10(' Wo', '1.00')
11('of', '1.00')
12(' Wo', '1.00')
13('of', '1.00')
14('<|im_end|>', '1.00')