Skip to main content

silver-torch

An optional PyTorch layer for Silver. It turns a small Silver preprocessing program into a fitted, inspectable, reusable tensor and DataLoader pipeline.

pip install silver-data
pip install 'silver-torch[pytorch]'
from silver_data import Dataset
from silver_torch import compile_silver

program = """
pipeline ieee_inverse:
  features voltage, current, phase, sensor
  categorical sensor
  label fault
  architecture transformer
  sequence_length 2
  scaling standard
  missing median
  label_type classification
  batch_size 128
  num_workers 2
  cache_dir .cache/ieee_inverse
"""

dataset = Dataset.from_records("ieee", [
    {"voltage": 1.0, "current": 2.0, "phase": 0.2, "fault": 0},
    {"voltage": 1.2, "current": 2.1, "phase": 0.3, "fault": 1},
])
splits = dataset.split(0.8, 0.1, 0.1)
pipeline = compile_silver(program).fit(splits.train.records())
loader = pipeline.dataloader(splits.validation.records(), device="cuda")
print(pipeline.plan(device="cuda").to_dict())
print(pipeline.benchmark(splits.validation.records(), steps=20))

The compiler has explicit research-safety boundaries:

  • statistics and vocabularies are fitted only on splits.train;
  • missing columns, non-finite numbers, invalid labels, and incompatible sequence lengths fail loudly;
  • categorical vocabularies are sorted for reproducibility and reserve index 0 for unknown values;
  • classification targets are torch.long; regression targets use the chosen floating dtype;
  • cache keys include the fitted-training fingerprint and transformed rows, and cache writes are atomic;
  • loaders are seeded and tune pinning, persistent workers, prefetching, and drop_last based on the declared runtime.

The emitted shapes are [batch, features] for MLP, [batch, 1, features] for CNN, and [batch, sequence_length, features_per_step] for RNN/Transformer. These are layout contracts, not model implementations. Measure with benchmark() on the target machine; input speedups depend on storage, CPU, worker count, batch size, and accelerator.

Download files

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

Source Distribution

silver_torch-0.3.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

silver_torch-0.3.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file silver_torch-0.3.0.tar.gz.

File metadata

  • Download URL: silver_torch-0.3.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for silver_torch-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b06253473cffe416543a3d99f317473d473db5fcca14b475a8deef7ddc59f9dc
MD5 942aa4cbfc875e8a94c99524e28695be
BLAKE2b-256 303992ea6c63f41c157ca3b4dacedeb0bb8051c2fddf3cac3359c1c6b43d4bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for silver_torch-0.3.0.tar.gz:

Publisher: release.yml on adfgdartec/silver-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 silver_torch-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: silver_torch-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for silver_torch-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94b62c8b5cce3cee8ac1be4ef6ea64ed1834339c597cd01aa6fa6ceee179cfd5
MD5 9932ef9801b6084d501873be92a1d3ca
BLAKE2b-256 4a70645c82dfa74c5e1a9dc3dc60e6394fe9f571a01015c2de2ce2168b4fe69c

See more details on using hashes here.

Provenance

The following attestation bundles were made for silver_torch-0.3.0-py3-none-any.whl:

Publisher: release.yml on adfgdartec/silver-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 Sentry Error logging StatusPage Status page