nemo_automodel.components.models.praxis.lora_export
nemo_automodel.components.models.praxis.lora_export
Fold the adapters of a LoRA run into the weights and write a Praxis checkpoint.
The checkpointer saves a LoRA run as adapters (adapter_model.safetensors next to the PEFT configs);
the reference runtime loads full checkpoints. This module merges the adapters into the linears they adapt
and writes the result in the checkpoint layout (config.json, model-XXXXX-of-NNNNN.safetensors
shards, model.safetensors.index.json, SHA256SUMS)::
python -m nemo_automodel.components.models.praxis.lora_export —checkpoint runwayml/praxis-1-droid
—adapters runs/libero_spatial_lora/epoch_0_step_599/model —out runs/libero_spatial_lora/merged_600
Module Contents
Functions
Data
API
The scale alpha / rank of every adapter module of model, by module name.
Expert adapters may run at a smaller rank than the linear adapters (moe_rank_scaling), so the
scale is read from each module rather than derived from the PEFT config.
Merge the adapters of a LoRA run into the base checkpoint and write the result to out.
Parameters:
The base checkpoint directory or its Hugging Face repo id.
The model directory of the LoRA run’s checkpoint step.
Output directory of the merged checkpoint.
The adapter tensors of a checkpointer’s PEFT save, under the parameter names of policy.
Parameters:
The model with its LinearLoRA layers applied.
The model directory of the checkpoint step.
Returns: dict[str, Tensor]
Every lora_A / lora_B parameter of policy with its saved value.
Command line: merge the adapters of a LoRA run into the base checkpoint and write the result.
Fold the adapters into the weights they adapt and drop the adapter tensors.
Linear adapters are <m>.lora_A.weight of shape [rank, in] and <m>.lora_B.weight of shape
[out, rank] next to <m>.weight; grouped-expert adapters are <m>.lora_gate_and_up_{A,B} and
<m>.lora_down_{A,B} of shapes [experts, in, rank] and [experts, rank, out] next to
<m>.gate_and_up_projs and <m>.down_projs.
Parameters:
Module state dict with the adapters.
The scale alpha / rank of each adapted module, by module name (adapter_scales).
Returns: dict[str, Tensor]
A new state dict with weight + scale * B @ A (scale * A @ B per expert) in the weight’s dtype.
Write native_state as a Praxis checkpoint directory.
Tensors are stored in the checkpoint dtype (torch_dtype of the config), except the
names matching fp32_tensors which stay float32.
Parameters:
Output directory (created; existing shards are replaced).
Full module state dict (CPU tensors) in module key names.
Converts module keys to checkpoint keys.
config.json of the checkpoint the weights derive from; copied verbatim.
Shard size limit.