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.1.0.tar.gz (33.0 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.1.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llm_layer_collector-1.1.0.tar.gz
Algorithm Hash digest
SHA256 00123fb1e60f8ab9f89232a60bfa64f670895ba832ec03929d188fe34f694a4b
MD5 b0b2357bbc5289ca4394e0f3a61c818f
BLAKE2b-256 f15793225752050df73903295472b782d76e166d9ea34abe39869ece8d401655

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_layer_collector-1.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_layer_collector-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f03cc031fb29241cf784866dc803af17536765d29d01d057c0ce8d5ced3958bb
MD5 d6408a0ed9081b884fe94d4a4a982216
BLAKE2b-256 9cf659c470776ebb02e84b33c56f9b9a31bc7029b265b1c3ced1f5536454de06

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_layer_collector-1.1.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

This release

1.1.0 This release

2 files

1.0.0

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