Skip to main content

Extract simplex arrays from PyTorch model outputs

Project description

fisher-torch

Extract simplex arrays from PyTorch model outputs.

Part of the Fisher stack — built on fisher-simplex for simplex geometry and invariants.

Install

pip install fisher-torch

With transformers support:

pip install fisher-torch[transformers]

Quick start

import torch
from fisher_torch import extract_predictions, capture_forward
from fisher_torch import SamplingPolicy

# From raw logits
logits = torch.randn(10, 50000)  # (seq_len, vocab_size)
simplex = extract_predictions(logits, top_k=50)
# simplex.shape == (10, 51)  — top-50 + remainder bin, valid simplex

# From a HuggingFace model
policy = SamplingPolicy(top_k=50, final_token_only=True)
result = capture_forward(model, input_ids, predictions=True, policy=policy)
# result.predictions is a float64 numpy simplex array
# result.projection_spec describes the projection geometry

Modules

Module Purpose
extractors Stateless functions: logits, attention, hidden states, routing → simplex arrays
capture Single forward pass orchestrator (capture_forward)
convert Tensor ↔ numpy simplex array conversion
sampling SamplingPolicy — controls which layers, heads, positions to extract
utils Numerically stable softmax, top-k simplex projection

Project details


Download files

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

Source Distribution

fisher_torch-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

fisher_torch-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file fisher_torch-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for fisher_torch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78b6c2403743ff414f47f727443c8bc40beca71b7f7427651df7b59829cd9049
MD5 3b76be1f0164e018368df600719e1aa8
BLAKE2b-256 c81335ddb7fdb4c58862a236544b6796ce7a3ec2ada18f84e0515df40fdbb9bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for fisher_torch-0.1.0.tar.gz:

Publisher: workflow.yml on syzygyhack/fisher-torch

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

File details

Details for the file fisher_torch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fisher_torch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fisher_torch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3db11943b51c9094d4a6caa8a1d22f14a73c3272c50535430fb60d2e6e8278e4
MD5 c0af4f1d9e82442db74ba1f43b578766
BLAKE2b-256 2618077a36f63da7a18fd250157cc308c8c10ee2d498e29c26883b9629b0f5c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fisher_torch-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on syzygyhack/fisher-torch

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page