Skip to main content

llm-layer-collector

Load and dispatch individual transformer layers from HuggingFace model checkpoints, rather than instantiating a whole model at once. Given a model directory (config + safetensors shards), it can materialize just the embedding, a range of decoder layers, the final norm, or the LM head — each as a standalone torch.nn.Module — and run computation through them.

This powers the layer-sharding used by language-pipes for distributed inference, but has no dependency on it and can be used on its own.

Install

pip install llm-layer-collector

Usage

from llm_layer_collector import LlmLayerCollector

collector = LlmLayerCollector(model_dir="/path/to/model", cache_file="cache.json")
embedding = collector.load_input_embedding()
layers = collector.load_layer_set(0, 4)   # decoder layers 0..4 (end inclusive)
norm = collector.load_norm()
head = collector.load_head()

Supported architectures

Llama, Phi-3, Qwen3, Qwen3-MoE, Gemma3, Gemma4, Ministral3. See src/llm_layer_collector/modeling/ for per-architecture support.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_layer_collector-1.0.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_layer_collector-1.0.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_layer_collector-1.0.0.tar.gz.

File metadata

  • Download URL: llm_layer_collector-1.0.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llm_layer_collector-1.0.0.tar.gz
Algorithm Hash digest
SHA256 51e0050117df7043afb6733b7fd7052f00c28ebe6ca72db6f3227b83afa167d4
MD5 87c0eb4a4c18aa860fb7bdbe69ab0f06
BLAKE2b-256 09c969c6945d9a97bfb1e997220f21a018713523bf9af5544b7792c6b5429948

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_layer_collector-1.0.0.tar.gz:

Publisher: publish-packages.yml on erinclemmer/language-pipes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_layer_collector-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_layer_collector-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1527a299def7989eb881ff3dd01d3a7259e3a051446cb91e53ab1966ecd2daca
MD5 ea77fa6d4a973f052a5d613ebd287ad2
BLAKE2b-256 542cca3bfffa3315d6e4ad2719477720d53880875a74257777ab8ca4c517fde2

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_layer_collector-1.0.0-py3-none-any.whl:

Publisher: publish-packages.yml on erinclemmer/language-pipes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.0

2 files

This release

1.0.0 This release

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page