Run this model with HF Jobs

Run LiquidAI/d1-2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/LiquidAI/d1-2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/LiquidAI/d1-2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/LiquidAI/d1-2B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/LiquidAI/d1-2B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
d1-2B / native_lfm3.py
paulpak58's picture mlabonne's picture Aurelien-Lac's picture
d1-2B
97c5704
Raw History Blame
1.27 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. transformers' own classes once a release ships them; until then copies of transformers' LFM3 code
beside these (each names its commit), registered with the Auto classes, so a checkpoint's config, tokenizer and
processor load and the composite models build their parts.
Shipping LFM3, transformers makes the fallbacks dead: delete them and the copies (the files headed "Vendored from"),
nothing else."""
from __future__ import annotations
try:
from transformers import Lfm3Config, Lfm3ForCausalLM, Lfm3Model
except ImportError:
from transformers import AutoConfig, AutoModel
from .configuration_lfm3 import Lfm3Config
from .modeling_lfm3 import Lfm3ForCausalLM, Lfm3Model
# exist_ok: a second copy of these files in one process (two snapshots) registers again
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"]