Skip to main content

dragon-torch

Tests on main PyPI version

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:

  1. Re-checks that the commit is on main and that its test job passed.
  2. Picks the next version with scripts/release.py.
  3. Builds the package and uploads it to PyPI.
  4. 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 one search-space preset per algorithm for its single- and multi-agent models (space_for); 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. Wrappers can be given as data (WrapperSpec, register_wrapper; see docs/envs.md). 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. Multi-agent versions of each are in multi_agent.py
Multi-agent envs dragon_torch/data/envs/multi_agent.py MultiAgentEnvConfig for PettingZoo-style ParallelEnvs and gymnasium envs with per-agent Dict spaces, agent groups (AgentGroups) and MultiAgentVectorEnv. See docs/multi_agent.md
Networks dragon_torch/modules/RL/ SingleAgentPolicyModule / MultiAgentPolicyModule; ActorCritic and MultiAgentActorCritic (one ActorCritic per agent group); PolicyOutput; and distribution heads for Discrete, MultiDiscrete, MultiBinary and Box actions
Losses dragon_torch/loss/RL.py PPOLoss and A2CLoss, which each record their components (KL, clip fraction, entropy), and MultiAgentLoss, which applies either one to each agent group
Model dragon_torch/models/RL/ DragonRLModel (abstract) adds gradient clipping and returns episode return from evaluate. Its epoch count comes from total_timesteps, minus the steps already taken. single_agent/ has SingleAgentRLModel and the algorithm models PPOModel / A2CModel; multi_agent/ has MultiAgentRLModel, MultiAgentPPOModel and MultiAgentA2CModel. Each algorithm model's config holds its loss settings (model.clip_coef, ...)
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. SingleAgentRLTrainer and MultiAgentRLTrainer handle the env kind, and algorithm mixins supply the loss: PPOTrainer, A2CTrainer, MultiAgentPPOTrainer and MultiAgentA2CTrainer. 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.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dragon-torch 1.1.4
File Size Uploaded Provenance Actions
dragon_torch-1.1.4.tar.gz 132.4 kB With provenance Details for dragon_torch-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dragon-torch 1.1.4
File Interpreter ABI Platform Actions
dragon_torch-1.1.4-py3-none-any.whl Python 3 none any Details for dragon_torch-1.1.4-py3-none-any.whl

Total release size: 237.5 kB

Release files / dragon_torch-1.1.4.tar.gz

Download URL dragon_torch-1.1.4.tar.gz
Size 132.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0aff457f3d41e71305ed6b0cc61f6952a773c0d0ac49cfcc2efe1bd745e03490
BLAKE2b-256 checksum
How to use checksums
4e569b80334bc58f7befb750f0a48f0171738fa73f61b8701252d18a601f33de
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 10, 2026.

Transparency log

Release files / dragon_torch-1.1.4-py3-none-any.whl

Download URL dragon_torch-1.1.4-py3-none-any.whl
Size 105.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a89a4879126f2f6d01ea0760720c59ca36e875360dcda3990c7d976c6bcbb62
BLAKE2b-256 checksum
How to use checksums
7510850cd38a66cb43a916b16c0c8bad655bd52da87e92b565f6e9772a978777
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 10, 2026.

Transparency log

Security for dragon-torch 1.1.4

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.

Select from 2 files

Attestation for dragon_torch-1.1.4.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 10, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page