import numpy as np data = np.fromfile("up-param.bin", dtype=np.float32) print(data.shape, data[:10])
For suspected LoRA weights:
import torch
weights = torch.from_numpy(data).view(r, -1) # if shape known
The .bin extension is a dead giveaway that this is not a human-readable text file (like JSON or YAML). It is a binary serialization format, most commonly produced by PyTorch’s torch.save() function or NumPy’s .tofile() method. up-param.bin
Most users do not want to run two files (base model + adapter) because it introduces latency. Instead, they merge the up-param.bin and down-param.bin into the base weights.
The formula:
base_weight = model.target_layer.weight.data
lora_up = torch.load("up-param.bin")
lora_down = torch.load("down-param.bin")
delta_w = (lora_up @ lora_down) * (alpha / r)
model.target_layer.weight.data += delta_w
After this operation, up-param.bin is no longer needed. You can delete it.
Warning: Modifying or flashing a corrupted up-param.bin can be hazardous. import numpy as np
data = np
Before using a community-sourced up-param.bin, run:
sha256sum up-param.bin
Compare this with the author's published hash. Because .bin files are binary, corruption by a single bit will destroy the adapter's performance. For suspected LoRA weights:
import torch
weights = torch