Basenji2 in PyTorch
This repo provides a PyTorch re-implementation of the Basenji2 model published in "Cross-species regulatory sequence activity prediction" by David Kelley. This implementation was checked by verifying that the Tensorflow and PyTorch version yielded the same output on random data. Small deviations were found, likely due to differences in the underlying algorithms used by Tensorflow and PyTorch (e.g. different matrix multiplication algorithms). In addition, Qixiu Du kindly computed evaluation metrics and found that the PyTorch re-implementation achieves competitive performance on real data, further validating the port.
Installation
pip install basenji2-pytorch
Usage
import torch
from basenji2_pytorch import Basenji2, basenji2_params, basenji2_weights # or PLBasenji2 to also use training parameters from Kelley et al. 2020
# to use a headless model e.g. for transfer learning
# basenji2_params["model"].pop("head_human", None)
basenji2 = Basenji2(basenji2_params["model"])
basenji2.load_state_dict(torch.load(basenji2_weights()), strict=False)
basenji2_paramsis a dictionary of both training and model parameters matching the implementation in Kelley et al. 2020basenji2_weightsis a function that uses pooch to download weights from Zenodo and return the path as a string.Basenji2is a PyTorch nn.Module that can be initialized from the model parameters ofbasenji2_paramsPLBasenji2is a PyTorch Lightning module that can be initialized frombasenji2_paramsto match both the training and architectural parameters of Basenji2
Metadata
Release files for basenji2-pytorch 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| basenji2_pytorch-0.1.2.tar.gz | 83.9 kB | Without provenance | Details for basenji2_pytorch-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| basenji2_pytorch-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for basenji2_pytorch-0.1.2-py3-none-any.whl |
Total release size: 91.9 kB
Release files / basenji2_pytorch-0.1.2.tar.gz
| Download URL | basenji2_pytorch-0.1.2.tar.gz |
|---|---|
| Size | 83.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5219ee21bdc41c09c62818a3ace647112377d26864ea2b9969b27fb08c78d848
|
|
BLAKE2b-256 checksum How to use checksums |
d5c55d0b5a5852262b0c04fc56f064c2049aeb637f6c72a5b540fae584c8ad57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.4
|
Release files / basenji2_pytorch-0.1.2-py3-none-any.whl
| Download URL | basenji2_pytorch-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f56c0797eb7758ff11bf9e1b4b9044eda487438e47a0b547e220f6a3ab32658e
|
|
BLAKE2b-256 checksum How to use checksums |
2dead6230cc9772edca0fd8c91638dc1c2e2def09b9a22cfabe6532906e96aea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.4
|
Security for basenji2-pytorch 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.