Skip to navigation

nemo_automodel.components.models.clef.export

View as Markdown

Merge CLEF adapters and typed heads into the publisher’s release layout.

Module Contents

Functions

NameDescription
export_releaseWrite the trained CLEF release, preserving the publisher’s loader and license.
merge_lora_Merge LoRA pairs into state_dict in place.

Data

logger

API

nemo_automodel.components.models.clef.export.export_release(
base: str | pathlib.Path,
revision: str,
stage: pathlib.Path,
out: pathlib.Path
) -> None

Write the trained CLEF release, preserving the publisher’s loader and license.

Parameters:

base
str | Path

Hub repository ID or existing local base release directory.

revision
str

Immutable Hub commit ID for remote model files.

stage
Path

Published native CLEF stage containing DCP head state and optional native PEFT model weights.

out
Path

Destination for the merged release.

nemo_automodel.components.models.clef.export.merge_lora_(
state_dict: dict[str, torch.Tensor],
adapter: dict[str, torch.Tensor],
scale: float
) -> int

Merge LoRA pairs into state_dict in place.

Parameters:

state_dict
dict[str, torch.Tensor]

Base weights by HF name; <module>.weight tensors have shape [out_features, in_features].

adapter
dict[str, torch.Tensor]

<module>.lora_A.weight of shape [rank, in_features] and <module>.lora_B.weight of shape [out_features, rank].

scale
float

LoRA scaling alpha / dim.

Returns: int

Number of merged modules.

Raises:

  • KeyError: If an adapter module has no matching base weight.
nemo_automodel.components.models.clef.export.logger = logging.getLogger(__name__)