Skip to main content

A sparse autoencoder implementation in Python for the PyTorch library

Project description

Torch Sparse Autoencoder

A Python library for implementing sparse autoencoders using PyTorch.

Installation

pip install torch-sparse-autoencoder

Usage

from torch_sparse_autoencoder import SparseAutoencoderManager

# Create a sparse autoencoder
manager = SparseAutoencoderManager(
    model=model,
    layer=target_layer,
    activation_dim=activation_dim,
    sparse_dim=activation_dim*4,
    device=device
)

# Train the autoencoder
manager.train(
    torch_dataset,
    num_epochs=5,
    batch_size=4,
    sparsity_weight=1e-3,
    verbose=True
)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

torch_sparse_autoencoder-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

torch_sparse_autoencoder-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for torch_sparse_autoencoder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6695bb857bb288b989198c7c5b9832f071c672e19ddd1c10ba7fb8b39e718e7
MD5 5ad891ad4df0491fc86b2393732faf02
BLAKE2b-256 3e8b69f11d8e81534a736ca46481e642b464ba2dfefa732d7cae4d4e3229123a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torch_sparse_autoencoder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68e554a886d5b49b1aa77e9c81b3468a5533aec473c8d3b1bae7126ab05f97e0
MD5 79fdb04636ae9bfb6f7f6508a77236ab
BLAKE2b-256 636c98304044d23671f3ca4a907af00231183c8ee7aade621c2f8716ca396d79

See more details on using hashes here.

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