hassanshka/Biomni-R0-32B-LoRA-Dequantized-Rank256
07
Biomni-R0-32B LoRA Adapter (Method B, Dequantized Corrected, Rank 256)
This is a LoRA adapter extracted using Method B - extracting from a dequantized (INT4 → BF16) version of the Biomni model for mathematically corrected weights.
Adapter Details
Method B Explanation
Unlike Method A (direct extraction), Method B uses a dequantized base model:
- Dequantize the quantized model (INT4 → BF16)
- Extract LoRA using the dequantized model as the new "base"
- Result: Mathematically corrected adapter that accounts for quantization artifacts
This approach can yield better results when the original base model weights have drifted during fine-tuning.
Usage with PEFT
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-32B",
device_map="auto",
torch_dtype="auto",
trust_remote_code=True
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "hassanshka/Biomni-R0-32B-LoRA-Dequantized-Rank256")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-32B")
# Inference
messages = [{"role": "user", "content": "Your biomedical question here"}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))Usage with vLLM
from vllm import LLM, SamplingParams
llm = LLM(
model="Qwen/Qwen3-32B",
enable_lora=True,
max_lora_rank=256
)
# Load LoRA at runtime
output = llm.generate(
prompts,
lora_request=LoRARequest("biomni", 1, "hassanshka/Biomni-R0-32B-LoRA-Dequantized-Rank256")
)Extraction Process
# Step 1: Dequantize the base model (see dequant script in extraction_scripts/)
# Step 2: Extract LoRA
mergekit-extract-lora \
--model "biomni/Biomni-R0-32B-Preview" \
--base-model "./dequantized_bf16_model" \
--out-path "./lora_output" \
--max-rank 256 \
--device cudaLicense
Apache 2.0
Citation
If you use this adapter, please cite both the original Qwen3 and Biomni models.
