Metadata-Version: 2.4
Name: metrik-torch
Version: 0.1.1
Summary: Metrik torch loader — observed ModelGraph extraction from a real nn.Module tree.
Project-URL: Homepage, https://github.com/Asmodeus14/Metrik
Project-URL: Repository, https://github.com/Asmodeus14/Metrik
Project-URL: Issues, https://github.com/Asmodeus14/Metrik/issues
Author: The Metrik Authors
License-Expression: Apache-2.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: metrik-sdk==0.1.1
Provides-Extra: torch
Requires-Dist: torch>=2.2; extra == 'torch'
Description-Content-Type: text/markdown

# metrik-torch

Observed `ModelGraph` extraction from a real `nn.Module` tree.

```console
$ pip install "metrik-torch[torch]"
$ metrik explore ./models/TinyLlama-1.1B --loader torch
```

The counterpart to `metrik-explorer`, which reads safetensors headers and `config.json` and
never imports torch. This package walks the actual module tree, so module classes, parameter
ownership, and **weight tying** are observed facts rather than claims from a config file.

Tying in particular: an untied `lm_head` has exactly the same shape as the embedding it does
not share, so shape is not evidence. Here it is established by storage identity.

## What it still does not know

Dataflow. `nn.Module` records containment, not what feeds what, so `edges` is `None` and
`fidelity` is `structural`. Recovering real edges needs tracing, which breaks on the dynamic
control flow most model implementations have. A consumer that needs edges checks `fidelity`
and refuses rather than reading a containment tree as a dataflow graph.

No forward pass, no device transfer, no weight value read — module structure and parameter
metadata only.

## Why torch is an optional extra

`uv sync --all-packages --dev` stays torch-free so the CI matrix keeps running in about a
minute. One dedicated job installs the extra and exercises extraction. See
[ADR 007](../../docs/planning/adr/007-ml-substrate.md).
