fn
load_weight_entry
→objectload_weight_entry(model: Module, weights: WeightsEnum | WeightEntry, name: str, strict: bool = True)Download the checkpoint described by weights and load it.
Parameters
modelModuleDestination model. Its
state_dict keys must match the
checkpoint's (the SafeTensors file is produced by the
conversion tool against this exact key layout).weightsWeightsEnum or WeightEntryThe checkpoint to load — either an enum member
(
ResNet18Weights.IMAGENET1K_V1) or a bare
WeightEntry.name(str, keyword - only)Cache identifier, conventionally
"<model>/<tag>" so each
checkpoint caches to its own directory.strict(bool, optional, keyword - only)= TrueForwarded to
Module.load_state_dict. False tolerates
missing / unexpected keys (e.g. when swapping the head).Returns
objectThe _IncompatibleKeys(missing_keys, unexpected_keys) result
from Module.load_state_dict.
Raises
RuntimeErrorOn SHA-256 verification failure, or on a key mismatch when
strict=True.Notes
SafeTensors loading goes through
lucid.serialization.load_safetensors (the sanctioned
external-world bridge); this module never touches numpy directly.