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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51e0050117df7043afb6733b7fd7052f00c28ebe6ca72db6f3227b83afa167d4
|
|
| MD5 |
87c0eb4a4c18aa860fb7bdbe69ab0f06
|
|
| BLAKE2b-256 |
09c969c6945d9a97bfb1e997220f21a018713523bf9af5544b7792c6b5429948
|
Provenance
The following attestation bundles were made for llm_layer_collector-1.0.0.tar.gz:
Publisher:
publish-packages.yml on erinclemmer/language-pipes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_layer_collector-1.0.0.tar.gz -
Subject digest:
51e0050117df7043afb6733b7fd7052f00c28ebe6ca72db6f3227b83afa167d4 - Sigstore transparency entry: 2192598000
- Sigstore integration time:
-
Permalink:
erinclemmer/language-pipes@e0cc4fda1fd7767aaed8cb381a3d9ae2c0842eba -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erinclemmer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-packages.yml@e0cc4fda1fd7767aaed8cb381a3d9ae2c0842eba -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_layer_collector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: llm_layer_collector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1527a299def7989eb881ff3dd01d3a7259e3a051446cb91e53ab1966ecd2daca
|
|
| MD5 |
ea77fa6d4a973f052a5d613ebd287ad2
|
|
| BLAKE2b-256 |
542cca3bfffa3315d6e4ad2719477720d53880875a74257777ab8ca4c517fde2
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_layer_collector-1.0.0-py3-none-any.whl -
Subject digest:
1527a299def7989eb881ff3dd01d3a7259e3a051446cb91e53ab1966ecd2daca - Sigstore transparency entry: 2192598076
- Sigstore integration time:
-
Permalink:
erinclemmer/language-pipes@e0cc4fda1fd7767aaed8cb381a3d9ae2c0842eba -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erinclemmer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-packages.yml@e0cc4fda1fd7767aaed8cb381a3d9ae2c0842eba -
Trigger Event:
push
-
Statement type: