jamesnavinhill/LiquidAI / d1-2b /native_lfm3.py
jamesnavinhill's picture
download
raw
1.57 kB
"""LFM3's transformers classes, one module a model type: `native_lfm3` (text), `native_lfm3_vl` (pictures),
`native_lfm3_omni` (pictures and audio), each importing the one before it, so a Hub repository serves only its
model's files. The classes are the copies of transformers' LFM3 code beside these (each names its commit), on every
transformers: the released weights, the recorded losses and `lfm3.lfm3_conv` were made on them. transformers ships
LFM3 from 5.23 (`lfm3`, `lfm3_vl`) as other code: a torch-only convolution, another picture processor and
placeholder. So the copies are registered with the Auto classes over transformers' own: a checkpoint's config and
processor load as these, and the composite models build their parts from these.
Moving to transformers' classes is a migration of its own, checked for parity on the released weights; until then
the copies (the files headed "Vendored from") stay."""
from __future__ import annotations
from transformers import AutoConfig, AutoModel
from .configuration_lfm3 import Lfm3Config
from .modeling_lfm3 import Lfm3ForCausalLM, Lfm3Model
# exist_ok: over transformers' class of the model type, and a second copy of these files in one process (two
# snapshots) registers again. A model mapping is read by config class, so the copies' configs give the copies' models.
AutoConfig.register(Lfm3Config.model_type, Lfm3Config, exist_ok=True)
AutoModel.register(Lfm3Config, Lfm3Model, exist_ok=True) # the composite models build their text model by config
__all__ = ["Lfm3Config", "Lfm3ForCausalLM", "Lfm3Model"]

Xet Storage Details

Size:
1.57 kB
·
Xet hash:
54f93769db6d7ecc52c6cebfde52b14eda75515118a076b2a1e3e8cc8b0b482e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.