dragon-torch
PyTorch Deep Learning Dev Modules
Sources:
Define source for data in a dataset. Source.getitem() is cached and returns the full dataset. Supported types:
- disk
- hugging-face
- hugging-face-polars
Datasets:
take a source as input. Dataset.getitem() returns an iterable of batches from the input source
NOTE: Dataset aggregators define batching rules / filters for combining two datasets
Tests:
Pushes to dev run the full test suite in GitHub Actions; when every test passes, dev is merged into main automatically. Pushes to main run the tests without merging anything. The badge above shows how many tests pass on main, and is refreshed after every main run. Run them locally with:
uv run --extra test --extra torch-cpu --extra torch-ext pytest # everything
uv run --extra test --extra torch-cpu --extra torch-ext pytest -m "not network" # skip Hugging Face Hub tests
Releases:
Install with pip install dragon-torch. Add extras as needed: dragon-torch[RL,torch-cpu] for RL training, [tune] for the dashboard. Everything imports from dragon_torch, for example from dragon_torch.trainers.RL import PPOTrainer.
When the tests pass on main, tests.yml starts release.yml. That workflow:
- Re-checks that the commit is on
mainand that itstestjob passed. - Picks the next version with
scripts/release.py. - Builds the package and uploads it to PyPI.
- Tags the commit
vX.Y.Z. A commit that already has a tag is never released twice.
Each release bumps the patch number of the latest release, carrying over when a part reaches its cap. The caps are 10, 10 and 20, so 1.1.20 is followed by 1.2.0, 1.10.20 by 2.0.0, and 10.10.20 is the last possible version. The version in pyproject.toml acts as a floor: set it higher, for example to 2.0.0, to jump straight to that version.
Uploads use PyPI trusted publishing. Add a publisher for this repo on PyPI with workflow release.yml and environment pypi.
Tuning / monitoring:
dragon_torch/utils/tuning/ runs optuna studies over any _DragonModel (pruning, multi-objective, shared storage for parallel workers) and serves them in optuna-dashboard. dragon_torch/utils/tuning/RL.py and dragon_torch/utils/tuning/presets/ tune any RL trainer with PPO / A2C search spaces; scripts/tune_rl.py runs a study worker. See docs/tuning.md.
uv sync --extra tune
dragon-tune dashboard --storage sqlite:///runs/optuna.db
TODO:
- : Setup Lazy Loading for hugging face sources.
- : Set up monitoring / experimentation with optuna
- : Implement off policy algorithms / dependencies.
- : Test Accelerate.prepare works with loaders
- : Test Accelerate.prepare works with gyms
- : OUActionNoise for RL
- : Research better state memory solutions
- : Trading environment as a test case in self implemented problem
RL
| Layer | Files | Contents |
|---|---|---|
| Env utils | dragon_torch/data/envs/ |
DragonEnvConfig and make_vec_env, which always uses SAME_STEP autoreset. Also validate_env, register_dragon_env, space conversions (obs_to_tensor, action_to_env), running normalisation, and Discretizer for stable-retro's button actions |
| Sources | dragon_torch/data/RL/ |
EnvCollector (env stepping, shared by all sources), the Actor protocol, Transition, RolloutSource with GAE, and EpisodeSource for evaluation |
| Networks | dragon_torch/modules/RL/ |
ActorCritic, PolicyOutput, and distribution heads for Discrete, MultiDiscrete, MultiBinary and Box actions |
| Losses | dragon_torch/loss/RL.py |
PPOLoss and A2CLoss; each records its components (KL, clip fraction, entropy) |
| Model | dragon_torch/models/RL/base.py |
DragonRLModel adds gradient clipping and returns episode return from evaluate. Its epoch count comes from total_timesteps, minus the steps already taken |
| Trainers | dragon_torch/trainers/RL/ |
DragonRLTrainer builds a whole run from one config: rollout source, evaluator, network, loss, optimizer, LR annealing, step-scheduled eval and a divergence guard. PPOTrainer and A2CTrainer add their loss. See docs/rl_trainers.md |
| SB3 | dragon_torch/modules/external/sb3.py |
DragonFeaturesExtractor and sb3_policy_kwargs |
Metadata
Release files for dragon-torch 1.1.1
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 |
|---|---|---|---|---|
| dragon_torch-1.1.1.tar.gz | 87.6 kB | With provenance | Details for dragon_torch-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dragon_torch-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for dragon_torch-1.1.1-py3-none-any.whl |
Total release size: 162.0 kB
Release files / dragon_torch-1.1.1.tar.gz
| Download URL | dragon_torch-1.1.1.tar.gz |
|---|---|
| Size | 87.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e80f611d4e51cd2398f0ffa8ef7900c02b03b0ea38ff7b3ac4546b0cf8c41f9
|
|
BLAKE2b-256 checksum How to use checksums |
44905bac4c0c6ef3bfa41ce39399b27cde9a2945a886de3344bd7d49f055e398
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / dragon_torch-1.1.1-py3-none-any.whl
| Download URL | dragon_torch-1.1.1-py3-none-any.whl |
|---|---|
| Size | 74.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17f4a5693533efea2392951488828c104be658501c360a6371aeecaf0dd55091
|
|
BLAKE2b-256 checksum How to use checksums |
e35c79a178501376dca8e0c9ba7f83f798dddabc7f4a69539f5650e7f0cb6f0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for dragon-torch 1.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dragon_torch-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA 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.