particle-imaging-models 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- particle_imaging_models-0.6.0.dist-info/METADATA +247 -0
- particle_imaging_models-0.6.0.dist-info/RECORD +211 -0
- particle_imaging_models-0.6.0.dist-info/WHEEL +4 -0
- particle_imaging_models-0.6.0.dist-info/entry_points.txt +2 -0
- particle_imaging_models-0.6.0.dist-info/licenses/LICENSE +21 -0
- pimm/__init__.py +33 -0
- pimm/cli/__init__.py +1 -0
- pimm/cli/__main__.py +7 -0
- pimm/cli/common.py +80 -0
- pimm/cli/export.py +138 -0
- pimm/cli/launch.py +60 -0
- pimm/cli/main.py +63 -0
- pimm/cli/submit.py +66 -0
- pimm/cli/trace.py +497 -0
- pimm/cli/watchdog.py +62 -0
- pimm/datasets/__init__.py +29 -0
- pimm/datasets/builder.py +17 -0
- pimm/datasets/dataloader.py +129 -0
- pimm/datasets/defaults.py +322 -0
- pimm/datasets/jaxtpc_dataset.py +484 -0
- pimm/datasets/lucid_dataset.py +271 -0
- pimm/datasets/next_h5.py +744 -0
- pimm/datasets/pilarnet/__init__.py +31 -0
- pimm/datasets/pilarnet/decode.py +414 -0
- pimm/datasets/pilarnet/default.py +88 -0
- pimm/datasets/pilarnet/h5.py +436 -0
- pimm/datasets/pilarnet/overlay.py +266 -0
- pimm/datasets/preprocessing/__init__.py +0 -0
- pimm/datasets/preprocessing/anchors.py +356 -0
- pimm/datasets/readers/__init__.py +6 -0
- pimm/datasets/readers/jaxtpc_corr_reader.py +190 -0
- pimm/datasets/readers/jaxtpc_labl_reader.py +150 -0
- pimm/datasets/readers/jaxtpc_resp_reader.py +180 -0
- pimm/datasets/readers/jaxtpc_seg_reader.py +281 -0
- pimm/datasets/readers/lucid_seg_reader.py +201 -0
- pimm/datasets/readers/lucid_sensor_reader.py +223 -0
- pimm/datasets/sphere_prior/__init__.py +5 -0
- pimm/datasets/sphere_prior/dataset.py +56 -0
- pimm/datasets/sphere_prior/episode.py +43 -0
- pimm/datasets/sphere_prior/geometry.py +81 -0
- pimm/datasets/sphere_prior/sampling.py +55 -0
- pimm/datasets/stateful.py +235 -0
- pimm/datasets/test_fragments.py +40 -0
- pimm/datasets/transform/__init__.py +10 -0
- pimm/datasets/transform/base.py +393 -0
- pimm/datasets/transform/color.py +806 -0
- pimm/datasets/transform/common.py +223 -0
- pimm/datasets/transform/detector.py +367 -0
- pimm/datasets/transform/instance.py +363 -0
- pimm/datasets/transform/multiview.py +468 -0
- pimm/datasets/transform/preparation.py +241 -0
- pimm/datasets/transform/spatial.py +1650 -0
- pimm/datasets/utils.py +118 -0
- pimm/datasets/wand.py +779 -0
- pimm/distributed/__init__.py +17 -0
- pimm/distributed/distributed.py +183 -0
- pimm/engines/__init__.py +0 -0
- pimm/engines/_execution.py +97 -0
- pimm/engines/_train_utils.py +406 -0
- pimm/engines/defaults.py +187 -0
- pimm/engines/hooks/__init__.py +12 -0
- pimm/engines/hooks/builder.py +18 -0
- pimm/engines/hooks/checkpoint.py +361 -0
- pimm/engines/hooks/default.py +145 -0
- pimm/engines/hooks/diagnostics.py +1402 -0
- pimm/engines/hooks/eval/__init__.py +7 -0
- pimm/engines/hooks/eval/events.py +206 -0
- pimm/engines/hooks/eval/final.py +82 -0
- pimm/engines/hooks/eval/instance.py +980 -0
- pimm/engines/hooks/eval/probes/__init__.py +4 -0
- pimm/engines/hooks/eval/probes/events.py +856 -0
- pimm/engines/hooks/eval/probes/mae.py +285 -0
- pimm/engines/hooks/eval/probes/points.py +955 -0
- pimm/engines/hooks/eval/probes/wc.py +276 -0
- pimm/engines/hooks/eval/rings.py +518 -0
- pimm/engines/hooks/eval/semantic.py +438 -0
- pimm/engines/hooks/eval/synthetic.py +406 -0
- pimm/engines/hooks/export.py +348 -0
- pimm/engines/hooks/logging.py +394 -0
- pimm/engines/hooks/optimizer.py +205 -0
- pimm/engines/hooks/profiling.py +139 -0
- pimm/engines/hooks/resources.py +334 -0
- pimm/engines/metrics/__init__.py +15 -0
- pimm/engines/metrics/fm4npp.py +26 -0
- pimm/engines/metrics/instance.py +318 -0
- pimm/engines/metrics/panoptic.py +218 -0
- pimm/engines/metrics/semseg.py +128 -0
- pimm/engines/test.py +851 -0
- pimm/engines/train.py +1321 -0
- pimm/export/__init__.py +23 -0
- pimm/export/api.py +648 -0
- pimm/export/checkpoint.py +284 -0
- pimm/launch/__init__.py +2 -0
- pimm/launch/_exex.py +333 -0
- pimm/launch/compat.py +161 -0
- pimm/launch/config.py +373 -0
- pimm/launch/local.py +349 -0
- pimm/launch/schema.py +288 -0
- pimm/launch/submit.py +596 -0
- pimm/launch/torchrun.sh +31 -0
- pimm/launch/utils.py +173 -0
- pimm/launch/watchdog.py +369 -0
- pimm/models/__init__.py +23 -0
- pimm/models/builder.py +16 -0
- pimm/models/classifier/__init__.py +4 -0
- pimm/models/classifier/event_classifier.py +533 -0
- pimm/models/classifier/sparse_event_classifier.py +32 -0
- pimm/models/default.py +417 -0
- pimm/models/litept/__init__.py +1 -0
- pimm/models/litept/litept.py +677 -0
- pimm/models/lora.py +220 -0
- pimm/models/losses/__init__.py +17 -0
- pimm/models/losses/builder.py +42 -0
- pimm/models/losses/instance.py +1000 -0
- pimm/models/losses/lovasz.py +369 -0
- pimm/models/losses/misc.py +591 -0
- pimm/models/modules.py +95 -0
- pimm/models/next/__init__.py +1 -0
- pimm/models/next/blobs.py +180 -0
- pimm/models/next/kekic_resnet.py +115 -0
- pimm/models/panda/__init__.py +5 -0
- pimm/models/panda/detector/__init__.py +3 -0
- pimm/models/panda/detector/layers.py +407 -0
- pimm/models/panda/detector/matcher.py +307 -0
- pimm/models/panda/detector/panda_detector_v2m1.py +925 -0
- pimm/models/panda/detector/postprocess.py +577 -0
- pimm/models/panda/encoder/__init__.py +3 -0
- pimm/models/panda/encoder/panda_encoder_v2m1.py +307 -0
- pimm/models/panda/pretrain/__init__.py +3 -0
- pimm/models/panda/pretrain/panda_ssl_v2m1.py +533 -0
- pimm/models/panda_detector/__init__.py +1 -0
- pimm/models/panda_detector/layers.py +594 -0
- pimm/models/panda_detector/matcher_fast.py +289 -0
- pimm/models/panda_detector/panda_detector_v1m1.py +695 -0
- pimm/models/panda_detector/postprocess.py +520 -0
- pimm/models/point_transformer_v3/__init__.py +3 -0
- pimm/models/point_transformer_v3/point_transformer_v3m1_base.py +726 -0
- pimm/models/point_transformer_v3/point_transformer_v3m2_sonata.py +867 -0
- pimm/models/point_transformer_v3/point_transformer_v3m8.py +997 -0
- pimm/models/polarmae/__init__.py +2 -0
- pimm/models/polarmae/data.py +58 -0
- pimm/models/polarmae/layers.py +640 -0
- pimm/models/polarmae/ops.py +288 -0
- pimm/models/polarmae/polarmae.py +225 -0
- pimm/models/polarmae/polarmae_semseg.py +256 -0
- pimm/models/sonata/__init__.py +3 -0
- pimm/models/sonata/sonata_v1m1_base.py +653 -0
- pimm/models/sonata/sonata_v1m2_uni_teacher_head.py +531 -0
- pimm/models/sparse_unet/__init__.py +4 -0
- pimm/models/sparse_unet/mink_unet.py +442 -0
- pimm/models/sparse_unet/spconv_unet_v1m1_base.py +463 -0
- pimm/models/sparse_unet/spconv_unet_v1m2_bn_momentum.py +290 -0
- pimm/models/sparse_unet/spconv_unet_v1m3_pdnorm.py +429 -0
- pimm/models/utils/__init__.py +9 -0
- pimm/models/utils/checkpoint.py +99 -0
- pimm/models/utils/checkpoint_loader.py +6 -0
- pimm/models/utils/hierarchical_features.py +257 -0
- pimm/models/utils/misc.py +90 -0
- pimm/models/utils/serialization/__init__.py +11 -0
- pimm/models/utils/serialization/default.py +150 -0
- pimm/models/utils/serialization/hilbert.py +369 -0
- pimm/models/utils/serialization/z_order.py +126 -0
- pimm/models/utils/stats.py +69 -0
- pimm/models/utils/structure.py +232 -0
- pimm/observability/__init__.py +5 -0
- pimm/observability/structured_logger/LICENSE +28 -0
- pimm/observability/structured_logger/README.md +234 -0
- pimm/observability/structured_logger/__init__.py +54 -0
- pimm/observability/structured_logger/gantt_generator.py +587 -0
- pimm/observability/structured_logger/jsonl_handler.py +310 -0
- pimm/observability/structured_logger/step_state.py +203 -0
- pimm/observability/structured_logger/structured_logging.py +569 -0
- pimm/ops/README.md +155 -0
- pimm/ops/__init__.py +17 -0
- pimm/ops/_attention_turing.py +96 -0
- pimm/ops/_fused.py +9 -0
- pimm/ops/attention.py +420 -0
- pimm/ops/hilbert.py +14 -0
- pimm/ops/knn.py +65 -0
- pimm/ops/rope.py +20 -0
- pimm/ops/sinkhorn.py +114 -0
- pimm/ops/submconv3d.py +194 -0
- pimm/ops/triton/__init__.py +5 -0
- pimm/ops/triton/attention.py +389 -0
- pimm/ops/triton/ball_query.py +73 -0
- pimm/ops/triton/cnms.py +64 -0
- pimm/ops/triton/fps.py +72 -0
- pimm/ops/triton/hilbert.py +56 -0
- pimm/ops/triton/knn.py +82 -0
- pimm/ops/triton/knn_points.py +170 -0
- pimm/ops/triton/sinkhorn.py +605 -0
- pimm/ops/triton/submconv3d.py +364 -0
- pimm/ops/triton/window_attention.py +298 -0
- pimm/test.py +42 -0
- pimm/train.py +84 -0
- pimm/utils/__init__.py +19 -0
- pimm/utils/cache.py +68 -0
- pimm/utils/checkpoints.py +1373 -0
- pimm/utils/comm.py +455 -0
- pimm/utils/config.py +777 -0
- pimm/utils/env.py +52 -0
- pimm/utils/events.py +1095 -0
- pimm/utils/logger.py +171 -0
- pimm/utils/misc.py +145 -0
- pimm/utils/optimizer.py +68 -0
- pimm/utils/path.py +169 -0
- pimm/utils/registry.py +363 -0
- pimm/utils/scheduler.py +246 -0
- pimm/utils/timer.py +71 -0
- pimm/utils/visualization.py +131 -0
- pimm/utils/warnings.py +86 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: particle-imaging-models
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Pretraining, fine-tuning and inference of foundation models for particle-imaging detectors
|
|
5
|
+
Project-URL: Homepage, https://github.com/DeepLearnPhysics/particle-imaging-models
|
|
6
|
+
Project-URL: Documentation, https://deeplearnphysics.org/particle-imaging-models/stable/
|
|
7
|
+
Author: Samuel Young
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: !=3.11.0,!=3.11.1,!=3.11.2,!=3.11.3,<3.13,>=3.10.12
|
|
11
|
+
Requires-Dist: addict>=2.4
|
|
12
|
+
Requires-Dist: exex-ml[wandb]>=0.5.0
|
|
13
|
+
Requires-Dist: h5py>=3.8; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
14
|
+
Requires-Dist: huggingface-hub>=0.24; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
15
|
+
Requires-Dist: numpy>=1.24; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
16
|
+
Requires-Dist: packaging>=21.0; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
17
|
+
Requires-Dist: pandas>=2.0; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
18
|
+
Requires-Dist: psutil>=5.9; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
19
|
+
Requires-Dist: pyyaml>=6.0
|
|
20
|
+
Requires-Dist: safetensors>=0.4; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
21
|
+
Requires-Dist: scikit-learn>=1.2; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
22
|
+
Requires-Dist: scipy>=1.10; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
23
|
+
Requires-Dist: spconv-cu126>=2.3.8; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
24
|
+
Requires-Dist: submitit>=1.5
|
|
25
|
+
Requires-Dist: torch-scatter>=2.1.2; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
26
|
+
Requires-Dist: torch>=2.4; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
27
|
+
Requires-Dist: torchdata>=0.8; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
28
|
+
Requires-Dist: triton>=3.0; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
29
|
+
Requires-Dist: typing-extensions>=4.8
|
|
30
|
+
Requires-Dist: tyro>=0.9
|
|
31
|
+
Requires-Dist: wandb>=0.17.1; sys_platform == 'linux' and platform_machine == 'x86_64'
|
|
32
|
+
Requires-Dist: yapf>=0.40
|
|
33
|
+
Provides-Extra: cluster
|
|
34
|
+
Requires-Dist: torch-cluster>=1.6.3; extra == 'cluster'
|
|
35
|
+
Provides-Extra: matplotlib
|
|
36
|
+
Requires-Dist: matplotlib>=3.7; extra == 'matplotlib'
|
|
37
|
+
Provides-Extra: nvml
|
|
38
|
+
Requires-Dist: nvidia-ml-py>=12.0; extra == 'nvml'
|
|
39
|
+
Provides-Extra: rich
|
|
40
|
+
Requires-Dist: rich>=13.0; extra == 'rich'
|
|
41
|
+
Provides-Extra: tensorboard
|
|
42
|
+
Requires-Dist: tensorboard>=2.12; extra == 'tensorboard'
|
|
43
|
+
Requires-Dist: tensorboardx>=2.6; extra == 'tensorboard'
|
|
44
|
+
Provides-Extra: termcolor
|
|
45
|
+
Requires-Dist: termcolor>=2.0; extra == 'termcolor'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
# particle imaging models
|
|
53
|
+
|
|
54
|
+
[Documentation](https://deeplearnphysics.org/particle-imaging-models/stable/) ·
|
|
55
|
+
[First run](https://deeplearnphysics.org/particle-imaging-models/stable/get-started/first-run.html) ·
|
|
56
|
+
[Models](https://deeplearnphysics.org/particle-imaging-models/stable/models/index.html) ·
|
|
57
|
+
[Recipe catalog](https://deeplearnphysics.org/particle-imaging-models/stable/reference/recipes.html)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## What's new
|
|
62
|
+
|
|
63
|
+
### 11-27-2026
|
|
64
|
+
|
|
65
|
+
- Panda V2: encoder, self-distillation pretraining and detector (`panda-{encoder,ssl,detector}-v2m1`), with recipes for
|
|
66
|
+
LArTPC, sPHENIX, water Cherenkov and NEXT in `configs/panda/v2`.
|
|
67
|
+
- New [`pimm.ops`](https://github.com/DeepLearnPhysics/particle-imaging-models/blob/main/pimm/ops/README.md) submodule of accelerated operations.
|
|
68
|
+
- You can now run Panda V2 on any CUDA GPU: add `attention_backend=torch` to a run's overrides to use PyTorch's attention
|
|
69
|
+
where FlashAttention can't run.
|
|
70
|
+
- pimm is on PyPI: run `pip install particle-imaging-models` in an environment with PyTorch 2.4 or newer.
|
|
71
|
+
- Panda V1 detector renamed `panda-detector-v1m1`; its recipes moved to `configs/panda/v1`.
|
|
72
|
+
- Removed Point Transformer v1 and v2, PointGroup and Volt.
|
|
73
|
+
|
|
74
|
+
### 04-07-2026
|
|
75
|
+
|
|
76
|
+
- PoLAr-MAE ([Young et al., 2025](https://arxiv.org/abs/2502.02558)), masked point modeling for liquid argon TPC data,
|
|
77
|
+
was added with its pretraining and semantic segmentation recipes.
|
|
78
|
+
|
|
79
|
+
### 12-12-2025
|
|
80
|
+
|
|
81
|
+
- First release of pimm, with Panda ([Young et al., 2025](https://arxiv.org/abs/2512.01324)): self-distillation
|
|
82
|
+
pretraining on PILArNet-M with a Point Transformer V3 backbone, semantic segmentation, and a detector for particles
|
|
83
|
+
and interactions.
|
|
84
|
+
|
|
85
|
+
## Introduction
|
|
86
|
+
|
|
87
|
+
pimm (particle imaging models) is a library for pretraining, fine-tuning and running foundation models on sparse point clouds
|
|
88
|
+
from particle-imaging detectors. You can import its models and operations into your own code, and the same package
|
|
89
|
+
includes a complete training framework, with a launcher for a workstation or a Slurm cluster.
|
|
90
|
+
|
|
91
|
+
## Install
|
|
92
|
+
|
|
93
|
+
On Linux x86-64 with an NVIDIA GPU:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
curl -sSL https://raw.githubusercontent.com/DeepLearnPhysics/particle-imaging-models/main/install.sh | bash
|
|
97
|
+
cd particle-imaging-models
|
|
98
|
+
uv run pimm --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
With the install script, you get [uv](https://docs.astral.sh/uv/) if it is missing, a clone of this repository, and a
|
|
102
|
+
locked training environment (PyTorch 2.10 with CUDA 12.6). pimm's own requirements are only lower bounds (Python
|
|
103
|
+
3.10.12 or newer, PyTorch 2.4 or newer), so you can also install pimm with `pip` into an environment you already have.
|
|
104
|
+
spconv is required, and its distribution must match your CUDA runtime (`spconv-cuXXX`; `spconv-cu126` is selected
|
|
105
|
+
here). Compiled operators, TensorBoard and plotting tools are optional extras. FlashAttention is installed in the
|
|
106
|
+
locked environment and used by default in Panda V2. On a GPU older than Ampere, or to use PyTorch's attention instead,
|
|
107
|
+
set `attention_backend=torch` for a run or pass `attention_backend="torch"` to `pimm.from_pretrained`. Run pimm commands through `uv run`; there is no environment to
|
|
108
|
+
activate.
|
|
109
|
+
|
|
110
|
+
To install with pip instead, into an environment that has PyTorch 2.4 or newer:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install torch-scatter -f https://data.pyg.org/whl/torch-<version>+<cuda>.html # e.g. torch-2.8.0+cu128
|
|
114
|
+
pip install particle-imaging-models
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The package is imported as `pimm`. The recipes and launcher settings are not in it, so to train, run `pip install -e .` in a
|
|
118
|
+
clone of this repository instead.
|
|
119
|
+
|
|
120
|
+
Or run pimm in a container. The image `ghcr.io/deeplearnphysics/pimm:main` contains the locked environment but not
|
|
121
|
+
the pimm source, so run it from your checkout:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
apptainer exec --nv docker://ghcr.io/deeplearnphysics/pimm:main pimm --help # Apptainer
|
|
125
|
+
docker run --rm --gpus all -v "$PWD:$PWD" -w "$PWD" ghcr.io/deeplearnphysics/pimm:main pimm --help # Docker
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
See [Install](https://deeplearnphysics.org/particle-imaging-models/stable/get-started/install.html) for step-by-step
|
|
129
|
+
installation with uv or pip, containers, launcher-only hosts, and the GPUs on which FlashAttention and BF16 are
|
|
130
|
+
supported.
|
|
131
|
+
|
|
132
|
+
## Run a released model
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
import pimm
|
|
136
|
+
|
|
137
|
+
model = pimm.from_pretrained("DeepLearnPhysics/Panda-Semantic", device="cuda") # Hugging Face
|
|
138
|
+
model = pimm.from_pretrained("artifacts/my-model", device="cuda") # local export
|
|
139
|
+
model = pimm.from_pretrained("exp/panda/v1/semseg/my-run/model/last", device="cuda") # run checkpoint
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Call `pimm.from_pretrained` to rebuild the model, load its weights and get it back in eval mode. You can give a Hugging
|
|
143
|
+
Face repository, a directory made with `pimm export`, or a checkpoint from one of your runs; for a checkpoint, the
|
|
144
|
+
architecture comes from the run's config. Prepare a model's inputs with the same transforms as the recipe it was
|
|
145
|
+
trained with. To label a full event, see
|
|
146
|
+
[Run a released model](https://deeplearnphysics.org/particle-imaging-models/stable/models/run.html); for the released
|
|
147
|
+
models, see [Models](https://deeplearnphysics.org/particle-imaging-models/stable/models/index.html).
|
|
148
|
+
|
|
149
|
+
## Minimal training example
|
|
150
|
+
|
|
151
|
+
Download PILArNet-M-mini, 120 events from the PILArNet-M dataset, from Hugging Face:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
uv run hf download DeepLearnPhysics/PILArNet-M-mini \
|
|
155
|
+
--repo-type dataset \
|
|
156
|
+
--local-dir data/PILArNet-M-mini
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Train a tiny semantic-segmentation model on one GPU of this machine:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
uv run pimm launch \
|
|
163
|
+
--train.config tests/tiny_semseg \
|
|
164
|
+
--resources.nproc-per-node 1 \
|
|
165
|
+
-- \
|
|
166
|
+
data.train.data_root="$PWD/data/PILArNet-M-mini" \
|
|
167
|
+
data.val.data_root="$PWD/data/PILArNet-M-mini"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The flags before the bare `--` are launcher settings, and the `key=value` pairs after it are overrides for the
|
|
171
|
+
training config. You'll find the run's config, log and checkpoints under `exp/tests/`. For what each saved file is, see
|
|
172
|
+
[First run](https://deeplearnphysics.org/particle-imaging-models/stable/get-started/first-run.html); to list every
|
|
173
|
+
recipe, run `uv run pimm ls`.
|
|
174
|
+
|
|
175
|
+
To run the same job on a Slurm cluster, use `pimm submit` with the same flags plus your account and partition. Add
|
|
176
|
+
`--dry-run` to print the job script without submitting it:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
uv run pimm submit \
|
|
180
|
+
--site slurm \
|
|
181
|
+
--resources.account <account> \
|
|
182
|
+
--resources.partition <gpu-partition> \
|
|
183
|
+
--resources.nproc-per-node 1 \
|
|
184
|
+
--resources.time 00:30:00 \
|
|
185
|
+
--train.config tests/tiny_semseg \
|
|
186
|
+
--dry-run \
|
|
187
|
+
-- \
|
|
188
|
+
data.train.data_root="$PWD/data/PILArNet-M-mini" \
|
|
189
|
+
data.val.data_root="$PWD/data/PILArNet-M-mini"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Remove `--dry-run` to submit the job. You get your prompt back as soon as the job is queued, and you'll find the
|
|
193
|
+
training log in the same run directory. Without `--site`, you get the generic `slurm` profile; give your account and
|
|
194
|
+
partition with flags or in a site file. To write a site profile for your cluster or run on several GPUs or nodes, see
|
|
195
|
+
[Scale up](https://deeplearnphysics.org/particle-imaging-models/stable/training/scale.html).
|
|
196
|
+
|
|
197
|
+
To train on another detector, write its events as `.npy` files or add a reader; see
|
|
198
|
+
[Bring your own data](https://deeplearnphysics.org/particle-imaging-models/stable/data/your-data.html).
|
|
199
|
+
|
|
200
|
+
## What's in pimm
|
|
201
|
+
|
|
202
|
+
| Area | Contents |
|
|
203
|
+
|---|---|
|
|
204
|
+
| Models | Panda V1, Panda V2 (self-distillation) and PoLAr-MAE (masked point modeling) pretraining; semantic segmentation, the Panda detectors and event classification; Point Transformer V3, SparseUNet, LitePT and the Panda V2 encoder as backbones |
|
|
205
|
+
| Data | PILArNet-M and sPHENIX (HDF5), WAND water Cherenkov, NEXT, JAXTPC, LUCiD, and a generic `.npy` reader |
|
|
206
|
+
| Operations | [`pimm.ops`](https://github.com/DeepLearnPhysics/particle-imaging-models/blob/main/pimm/ops/README.md): accelerated attention, distillation loss, sparse convolution and serialization |
|
|
207
|
+
| Training | `torchrun` with DDP, an experimental FSDP2 path, Slurm through Submitit |
|
|
208
|
+
| Models out | Portable exports, loaded with `pimm.from_pretrained` from disk or Hugging Face |
|
|
209
|
+
|
|
210
|
+
pimm is research software; its APIs and recipes can change between versions.
|
|
211
|
+
|
|
212
|
+
## Documentation
|
|
213
|
+
|
|
214
|
+
| To | Read |
|
|
215
|
+
|---|---|
|
|
216
|
+
| see how a config becomes a training run | [How pimm works](https://deeplearnphysics.org/particle-imaging-models/stable/get-started/how-pimm-works.html) |
|
|
217
|
+
| change a recipe or override it on the command line | [Configs and overrides](https://deeplearnphysics.org/particle-imaging-models/stable/training/configs.html) |
|
|
218
|
+
| fine-tune a released model | [Fine-tune](https://deeplearnphysics.org/particle-imaging-models/stable/models/fine-tune.html) |
|
|
219
|
+
| resume a run or find its checkpoints | [Checkpoints and resume](https://deeplearnphysics.org/particle-imaging-models/stable/training/checkpoints.html) |
|
|
220
|
+
| export weights or publish them on Hugging Face | [Export and publish](https://deeplearnphysics.org/particle-imaging-models/stable/models/export.html) |
|
|
221
|
+
| add a model, dataset, transform, loss or hook | [Add a component](https://deeplearnphysics.org/particle-imaging-models/stable/develop/add-component.html) |
|
|
222
|
+
| fix a failed run | [Troubleshooting](https://deeplearnphysics.org/particle-imaging-models/stable/training/troubleshooting.html) |
|
|
223
|
+
| look up a command, recipe, registered name or environment variable | [Reference](https://deeplearnphysics.org/particle-imaging-models/stable/reference/index.html) |
|
|
224
|
+
|
|
225
|
+
## Contributing
|
|
226
|
+
|
|
227
|
+
See [Contributing](https://deeplearnphysics.org/particle-imaging-models/stable/develop/contributing.html).
|
|
228
|
+
|
|
229
|
+
pimm is built on [Pointcept](https://github.com/Pointcept/Pointcept),
|
|
230
|
+
[torchtitan](https://github.com/pytorch/torchtitan) and [TorchRL](https://github.com/pytorch/rl), and it is
|
|
231
|
+
distributed under the [MIT License](https://github.com/DeepLearnPhysics/particle-imaging-models/blob/main/LICENSE).
|
|
232
|
+
|
|
233
|
+
## Citation
|
|
234
|
+
|
|
235
|
+
If you use pimm, please cite the repository and the papers for the models you use (their BibTeX entries are on
|
|
236
|
+
the [Panda](https://deeplearnphysics.org/particle-imaging-models/stable/models/panda.html) and
|
|
237
|
+
[PoLAr-MAE](https://deeplearnphysics.org/particle-imaging-models/stable/models/polarmae.html) pages):
|
|
238
|
+
|
|
239
|
+
```bibtex
|
|
240
|
+
@misc{pimm,
|
|
241
|
+
title = {pimm: particle imaging models},
|
|
242
|
+
author = {Samuel Young},
|
|
243
|
+
year = {2025},
|
|
244
|
+
howpublished = {\url{https://github.com/DeepLearnPhysics/particle-imaging-models}},
|
|
245
|
+
note = {Version 0.6.0}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
pimm/__init__.py,sha256=7Sf5gWRQ7HKI27QsIPf-HjQQPzzbxFUPcvZ66VG6Zp8,1021
|
|
2
|
+
pimm/test.py,sha256=f921cmM1lAumV0sRsSkEBOz05rB1kAFQIWl78tdkmgM,1197
|
|
3
|
+
pimm/train.py,sha256=ULKDf2JL4uv295WnCCOTTkQbaIZv-PxKw5cmR3Cmp8I,2918
|
|
4
|
+
pimm/cli/__init__.py,sha256=C4Xy4Eii57bW0_SdSLkOiyB-WKVmq1wMASZ1aV8nNQw,41
|
|
5
|
+
pimm/cli/__main__.py,sha256=lyZfwOe71q1qYFZ05CYVVLPXaJpVSFBKEjOkjttEP-U,161
|
|
6
|
+
pimm/cli/common.py,sha256=KvZXoArC1OCecv8fTbSY4-i1QEbErmT5_1uDmNxF7i4,2674
|
|
7
|
+
pimm/cli/export.py,sha256=FZvzKJK9SAN9qS9ejHk3Xh-AIpwV4zzRSMMxlT1qQdY,5439
|
|
8
|
+
pimm/cli/launch.py,sha256=l4FsRKynZVKB4rA1WjBT54jA9_FI4LOs63tnKpcEXc8,1977
|
|
9
|
+
pimm/cli/main.py,sha256=ILd6WVY8AoL39dRANzonVlUU3vlNZbvxoL7dYmnY-FY,2130
|
|
10
|
+
pimm/cli/submit.py,sha256=YyTSXiGQdmB7buik_BKEufKRZ0AYCT79mAjSg4P34S4,2310
|
|
11
|
+
pimm/cli/trace.py,sha256=prXzXHbbabBOHS27aKFmMoDUDZXiixXFGuv4vQco1MA,16059
|
|
12
|
+
pimm/cli/watchdog.py,sha256=NyfsNsAFO1q9sAMbdLvXKJXwOLuDWTfj25YG0VxFZCg,2105
|
|
13
|
+
pimm/datasets/__init__.py,sha256=aL7lUuwaxQ_u3n492UM8iCatPgZPQUOJP-Ok761ey04,889
|
|
14
|
+
pimm/datasets/builder.py,sha256=98zCF6K4kHLXIWqOTdW55lbKAcPLGhXFU3Fk64CMMjY,511
|
|
15
|
+
pimm/datasets/dataloader.py,sha256=BeMYajfFCTcWtoIz6mMECFuaf698RCkhs2AZ6iaH08g,4701
|
|
16
|
+
pimm/datasets/defaults.py,sha256=-uZSJg5CcomCgeA23to9U50apY8uaVRs_mcsjHq48Do,13120
|
|
17
|
+
pimm/datasets/jaxtpc_dataset.py,sha256=k8oRC9Us2duML0hFKWTPIVuHA_avfCmlvIdyvv3DJiI,21096
|
|
18
|
+
pimm/datasets/lucid_dataset.py,sha256=6HUfEZYP1fvKt3n7BFwyAo5PZnAAUy-YIO8VfSh04mU,12069
|
|
19
|
+
pimm/datasets/next_h5.py,sha256=HlmdOldwwoJ_4mob4EA5-zAqajsp7j1GdNw6qMeZnfM,30509
|
|
20
|
+
pimm/datasets/stateful.py,sha256=kA0EDN99WNk6aOhzOaLn57uePi-b13qMHpmHSMTNyqE,9209
|
|
21
|
+
pimm/datasets/test_fragments.py,sha256=VrEVm3XQryksn5_4qzjVGYQgUb4qZ37xbNNjZk5tZC8,1247
|
|
22
|
+
pimm/datasets/utils.py,sha256=jCpMPdaNLm25uI2oxLK5dzIvw_qNT1HlkTKC4NcocjM,4360
|
|
23
|
+
pimm/datasets/wand.py,sha256=RXQNdp08FF8PT_nE_ZQwsFXdfwkg1Bhb39o73xTjfD8,32304
|
|
24
|
+
pimm/datasets/pilarnet/__init__.py,sha256=JIO8IXhjpHexOG7pvgDl4VPOBWOYN1QTBIdkAW71Qf8,861
|
|
25
|
+
pimm/datasets/pilarnet/decode.py,sha256=XnH7JFEbCxHeoDM1SGAOte74rYzdD3Grxjj3VRevhE4,16198
|
|
26
|
+
pimm/datasets/pilarnet/default.py,sha256=Gqqi51pgK78Uvk6i-Sue2Cd2rG-6bka3UKwb5eYOyTQ,3198
|
|
27
|
+
pimm/datasets/pilarnet/h5.py,sha256=W5VzeoRljMZVpy2G1yH_SxRFTKT2RFQyOoTfin1syuc,19482
|
|
28
|
+
pimm/datasets/pilarnet/overlay.py,sha256=VuhAdtQwhlb5RgXKEb3dHcCeP5BMYLPQeqkHPKBapV0,11546
|
|
29
|
+
pimm/datasets/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
pimm/datasets/preprocessing/anchors.py,sha256=5hTjMHI5WVGNl8h7KAaLdUHuob-7brfAAWX7ThgFbCM,13596
|
|
31
|
+
pimm/datasets/readers/__init__.py,sha256=tmMuF00--MQcYz0Vmm48Q48WPvlH1y4EiIIsjQeoWsM,290
|
|
32
|
+
pimm/datasets/readers/jaxtpc_corr_reader.py,sha256=yjtiQzA6hnC31VGaUpya0DA2Owr1uKef5il0_Wb90FU,6577
|
|
33
|
+
pimm/datasets/readers/jaxtpc_labl_reader.py,sha256=q8fPUSTN7QvRtNefKoOw7mw5XL8_jXprVYFfSuZ4DSU,5058
|
|
34
|
+
pimm/datasets/readers/jaxtpc_resp_reader.py,sha256=Xvra3a-mvpJByAfUfEsDN5-FtcxkSAND6QqnhYPcomE,6303
|
|
35
|
+
pimm/datasets/readers/jaxtpc_seg_reader.py,sha256=hPtM8YTsqKecfJcPGbT1EEa3pBK7QlFwgPxkc96EJlg,10622
|
|
36
|
+
pimm/datasets/readers/lucid_seg_reader.py,sha256=IdeFB5PMeHgg_1-e5meiAkaJ1ydyjuFAoUQRmEPkViI,7226
|
|
37
|
+
pimm/datasets/readers/lucid_sensor_reader.py,sha256=pSgh6boMA5r8RQTAQej8wiya8i3l478BWE57eL5Ik2g,8696
|
|
38
|
+
pimm/datasets/sphere_prior/__init__.py,sha256=-0go2NBna3fwYx36cAR5fJz9cpnf4QHV6-pMckbgReU,137
|
|
39
|
+
pimm/datasets/sphere_prior/dataset.py,sha256=weVqflaUau7smhcNd9YLPdAKiozBx4SqVusfFWUXpSQ,2041
|
|
40
|
+
pimm/datasets/sphere_prior/episode.py,sha256=q-DmoYwdNGSkTTYtw6DldueKykmSyTuzhBjs_NM0PuY,2289
|
|
41
|
+
pimm/datasets/sphere_prior/geometry.py,sha256=obPDRF9mBxs9j0fZBWeqli6_KoARydH5I2VMnuCmfdM,3573
|
|
42
|
+
pimm/datasets/sphere_prior/sampling.py,sha256=VDeqSV-SJ86radFps8a4qAbrHn1cXI_a1nqhzbSF4tU,1578
|
|
43
|
+
pimm/datasets/transform/__init__.py,sha256=PPIeers7Bh8Hajw-t7dG5uuIXx_oBzxN8C73FzNuT2s,273
|
|
44
|
+
pimm/datasets/transform/base.py,sha256=euYUD4N4ex8V-8GVhG-f_Z1MnbnrVoTUbr4_axdvMV0,17786
|
|
45
|
+
pimm/datasets/transform/color.py,sha256=A3gjivClkTPSk9TJn8nbus0ipoMMpTureyUFYty4gG8,32129
|
|
46
|
+
pimm/datasets/transform/common.py,sha256=Flj8femUAfk1mVqEzzcNqgycXnvQNO2wEPoaWb-g9go,7273
|
|
47
|
+
pimm/datasets/transform/detector.py,sha256=xvaBP-e3l-BYE28FSd--u5xPLpyKoiR_MT5vQ84kEdY,14736
|
|
48
|
+
pimm/datasets/transform/instance.py,sha256=tlRxu7rmg-wamNjZFW6fGAsotU6T8kSpjZf7gyL8iko,17111
|
|
49
|
+
pimm/datasets/transform/multiview.py,sha256=kyGyETo2OLKVSp2FE_guP9WpvQIQmNJWPi4MjagTyTE,21645
|
|
50
|
+
pimm/datasets/transform/preparation.py,sha256=xABEj_T4LsQ6KvYveF6M-fxr1gOj4atz5bcB9XZLwXo,10944
|
|
51
|
+
pimm/datasets/transform/spatial.py,sha256=mmFPGJblaa_EzmYDTXZDl9ZQfDHQlWtL2aw5waCxM2M,74479
|
|
52
|
+
pimm/distributed/__init__.py,sha256=IF27SPsAqVthD0XJOU8HHa9BRBiHeQrvkqEMIYc2RGY,337
|
|
53
|
+
pimm/distributed/distributed.py,sha256=UIgAP0PC9n0JJy37Wrwuaxkdbp8j53PrLg-TMOGwtjA,7187
|
|
54
|
+
pimm/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
+
pimm/engines/_execution.py,sha256=oWvzYVwUkrvJl_DbTJCGQtUuIw7bPUCGpO09JXD6XXk,3959
|
|
56
|
+
pimm/engines/_train_utils.py,sha256=DIJRVN__VgtRZWZZGqmquwktLwWNEH7gd4Um_7ZcjeA,14802
|
|
57
|
+
pimm/engines/defaults.py,sha256=c6o7eG7GmVwENlR1W9NGeES3LafMv-COkOtPRf3eYJA,7442
|
|
58
|
+
pimm/engines/test.py,sha256=H_gqLKYLi2lLALIwSHuteWokkWVIVbVesTZaobw7YfA,31315
|
|
59
|
+
pimm/engines/train.py,sha256=iLTl1NlyaqKCkaGo2SIx4ZcyTIOdMOib5cY-g1qn1x4,56853
|
|
60
|
+
pimm/engines/hooks/__init__.py,sha256=Z8s1-xv-Fz5xCLpCbHmgLbO312fFufQNdv1roC27b0U,328
|
|
61
|
+
pimm/engines/hooks/builder.py,sha256=ogafhTajVGMXdcm9GD5a5Sl-Lj4ZGjlMiX0XW1BSMVw,316
|
|
62
|
+
pimm/engines/hooks/checkpoint.py,sha256=Gz7giFFWbBjc3hEqqU5QgOzD-tu_ZiLUx0xdBh_QI0w,16314
|
|
63
|
+
pimm/engines/hooks/default.py,sha256=fNL90slhO9m8yh534CgIR8Ploxb8NVyqwQq5K5Yxws4,5220
|
|
64
|
+
pimm/engines/hooks/diagnostics.py,sha256=f5KmV-dbTPIE9qdySNqoE0RyTUHG8KLJ4HzJVRYrfLI,62536
|
|
65
|
+
pimm/engines/hooks/export.py,sha256=IasWqKYUNETCTqRSry_530NMvn9mXziXicsGGb2vwYo,15742
|
|
66
|
+
pimm/engines/hooks/logging.py,sha256=y1Wz7I4kBxqkbC0rgu0rsKjmWAHt1vTLLmdPkoswx-U,16424
|
|
67
|
+
pimm/engines/hooks/optimizer.py,sha256=HW7GmXml2iIdKMYT9sS07Sy7S4BC1nUeh4XJ1gkWSVI,8914
|
|
68
|
+
pimm/engines/hooks/profiling.py,sha256=GyMkfPyTbT5lOd9-sDwZoqIVrGfX2axqWPkrS2O7X9c,5478
|
|
69
|
+
pimm/engines/hooks/resources.py,sha256=ozVKT55NvYPEyfj4_WTHk49ZhsK1x188EDAMHzgGouE,13527
|
|
70
|
+
pimm/engines/hooks/eval/__init__.py,sha256=p9Klbi-rWt4I4aadko9NPi8a2dgJNqHsywuSTTOZdPI,310
|
|
71
|
+
pimm/engines/hooks/eval/events.py,sha256=nJpGacUiePAS7ScX8FkktPaTARn1GHvgWQNF29H_MJE,8649
|
|
72
|
+
pimm/engines/hooks/eval/final.py,sha256=m9zI-jQrtQxn8CnTP-Q3C9q48XfzPsPI3DzkZKe9pdQ,3354
|
|
73
|
+
pimm/engines/hooks/eval/instance.py,sha256=zc7hiFhVUdD0ggJgXlas9XPqiiYYp4_Es36s6LOlpvQ,41561
|
|
74
|
+
pimm/engines/hooks/eval/rings.py,sha256=0Y7IYM520hRWJDp3DqA9mdvG-y-jnCrt6S_2iL6V1Pg,22542
|
|
75
|
+
pimm/engines/hooks/eval/semantic.py,sha256=cedjGLAHJGdf284Zl-JwmBM5fdNh8tZBEqYkyqqXtDk,18953
|
|
76
|
+
pimm/engines/hooks/eval/synthetic.py,sha256=27LvKVyuH7Y4XELlsOPMuh5gesp6EWIJRlLkVZ8xU-c,14719
|
|
77
|
+
pimm/engines/hooks/eval/probes/__init__.py,sha256=wLwk6CP-KLK4q2XRrxMYH1BcRmEP85JxmDyIroH8L8A,149
|
|
78
|
+
pimm/engines/hooks/eval/probes/events.py,sha256=O0yCf9sD69uc8KIKwBm_vtpDJ4KQSZcL29_nYd8ZM1A,33342
|
|
79
|
+
pimm/engines/hooks/eval/probes/mae.py,sha256=SdMOojlFzYUZcbzRuRyWCLTXfIBgLxzEpn5S2m5d3qA,11791
|
|
80
|
+
pimm/engines/hooks/eval/probes/points.py,sha256=8v7LIyKJnZEZoerhvzCMKv1nYwJASd-0UM3rEmHXfxA,39198
|
|
81
|
+
pimm/engines/hooks/eval/probes/wc.py,sha256=8tg9grpXU2_VA58eMubQfi-hXczW-UUAEWa4tU9EA_k,11417
|
|
82
|
+
pimm/engines/metrics/__init__.py,sha256=2AafX3N9dBQs8-ifWp1u0N-oB3Q33v-OFL75ktlp_uw,443
|
|
83
|
+
pimm/engines/metrics/fm4npp.py,sha256=gJEs_K1JD4ptEUWWwrQ6MVvKJ_RXMmPiIPNOBBqFyNs,942
|
|
84
|
+
pimm/engines/metrics/instance.py,sha256=rwAhrlgZMmwNoaoenodWqFmNtSkbs-YcMrymFAOrgaQ,11973
|
|
85
|
+
pimm/engines/metrics/panoptic.py,sha256=7zgfJ-7Pgb7HBjiLzSPTO0wVaaLewaVJIRa2Z3AJTzU,8624
|
|
86
|
+
pimm/engines/metrics/semseg.py,sha256=2tWneiFIpJGCgSpuOBWy4W7hB00xOanFhvTuDtHFYHs,4067
|
|
87
|
+
pimm/export/__init__.py,sha256=GlF7QjFeBCF4ae-3QNbc8DFJMcJDF0vYi3ash4uWo5k,596
|
|
88
|
+
pimm/export/api.py,sha256=XqRmPFRVtgONEE0iM2cxgbanUNM3-yJ5zYNP_Awd9IM,25039
|
|
89
|
+
pimm/export/checkpoint.py,sha256=XuQoibVaoThERinNBfpCT5zeqfwBKYdjRMYEwTtSG64,9795
|
|
90
|
+
pimm/launch/__init__.py,sha256=h0fUAWjMUyxyZVF1di0U3ZFF7J-yUH3JA3trm_qKPtk,75
|
|
91
|
+
pimm/launch/_exex.py,sha256=zfZ-j0xqC4elhZZHRrmfvDTj9_-Cazajd8QOSgoQwzU,11343
|
|
92
|
+
pimm/launch/compat.py,sha256=BsBW4AwgXoPlgGCN7MdYFr5DvPdSRTD-PeP0HdQ7J2Y,5137
|
|
93
|
+
pimm/launch/config.py,sha256=7Orcky2Hrdd003qUl9qEe9xZG-CNfmupaxxbcme8ixw,13790
|
|
94
|
+
pimm/launch/local.py,sha256=ujkapE25Rj1wKIqutGJQAkGZk9e3vKVp7YxiB5v_JLs,13068
|
|
95
|
+
pimm/launch/schema.py,sha256=crDZaEChN-zPdpsge2wyVl1Pe1wILRPHUF6PiFNRii4,10002
|
|
96
|
+
pimm/launch/submit.py,sha256=CujWaAgOnP9ReVByhpJCRGJ3ZM6EaQYgm6emq3l5CbQ,23238
|
|
97
|
+
pimm/launch/torchrun.sh,sha256=mLnhCX1nTDnBduUc_zTArNVpgGrf_zMw1AGGUR7DHCk,1079
|
|
98
|
+
pimm/launch/utils.py,sha256=VV2Ys3_218k69YQ79TCypxzDLmtD76NHG0SgI0Xtjvw,5629
|
|
99
|
+
pimm/launch/watchdog.py,sha256=n_JbIdC38xv3xalbQfabsqL6253qZST13BCo0RJyu2I,13786
|
|
100
|
+
pimm/models/__init__.py,sha256=1Ju4UbojWm3buOcQ3sUCXyhMlm3S3V5PapE3vmX2T9c,511
|
|
101
|
+
pimm/models/builder.py,sha256=ut1KSihvWUPQH605L0vQ0EWdZBTpvDzkq3knzw7YHlE,300
|
|
102
|
+
pimm/models/default.py,sha256=EUpIVD-Po4bhvB7KfrtaG-JU6qg5B4nFP-hH2lE2Mqc,15781
|
|
103
|
+
pimm/models/lora.py,sha256=-M0iYwJOgtUNyk_0jtDfskMwbhc4HTmr4E71Jj33cWc,8818
|
|
104
|
+
pimm/models/modules.py,sha256=cXe2I_UWlfs3iArG94OCLoOVbbMzFQUT9FywSWheg3g,3259
|
|
105
|
+
pimm/models/classifier/__init__.py,sha256=N3qH6IpDVB5CcrC9C3VIbup2jCvmzti9sQpW6lsLYWQ,197
|
|
106
|
+
pimm/models/classifier/event_classifier.py,sha256=_vBG9TjBznBziS-LQArz4gICQiyWyxBGL5x0ZqZ3f6w,23252
|
|
107
|
+
pimm/models/classifier/sparse_event_classifier.py,sha256=o8BsnizbAUZQrAS-3qNgaGPAkEP6GW45xP0k_iqDp_4,1140
|
|
108
|
+
pimm/models/litept/__init__.py,sha256=JFL_Z4D0fnD_jVU1WB0EWvk_hJq5pqAxvYEfDsHQyeE,22
|
|
109
|
+
pimm/models/litept/litept.py,sha256=8F47WFYVOvZH_g923tWworg5W7ip0XQIj8_mJa0KHbQ,24607
|
|
110
|
+
pimm/models/losses/__init__.py,sha256=UfXbRdpy5QnTX9cK3U2T-qZ8AxI25y5z90CgJTOkYmw,385
|
|
111
|
+
pimm/models/losses/builder.py,sha256=h6wfDIo9c9Rsi7TS3IDsgVITSLcEuF-4e1hJHFGWT-I,1076
|
|
112
|
+
pimm/models/losses/instance.py,sha256=DnwPR1raL6FcW_Sj_KAv9C9aULRTj7aHqV1tNSrbK4Q,42365
|
|
113
|
+
pimm/models/losses/lovasz.py,sha256=g85qB96I5hINBMpkz1Q2pC3cGWAIyLsfyzFO3tdDTC8,14020
|
|
114
|
+
pimm/models/losses/misc.py,sha256=dRJpk7S9S4m2xfI8tiU5NbkcyiYbr6M0hIuo9jXnJBc,23650
|
|
115
|
+
pimm/models/next/__init__.py,sha256=QDWi0bgtR0_NTxph9bVqCez4AXKPF0pP3q3wi9a1voE,44
|
|
116
|
+
pimm/models/next/blobs.py,sha256=oHLFzAjgLIzZM-gVTmUaC3mlMOKTcDGrwhN1pqxZob8,5966
|
|
117
|
+
pimm/models/next/kekic_resnet.py,sha256=d50nTF-2i9fgv3rOoctheD5TMCw0qmLeS-piPKBUrRo,4523
|
|
118
|
+
pimm/models/panda/__init__.py,sha256=uOMKDX8XI4mkVw1Om4otQHsBrzLVZLmR1MT4KSGoeWo,196
|
|
119
|
+
pimm/models/panda/detector/__init__.py,sha256=suw9KX8OsfPUzlJV3c5CsG-PObDR3_JK42sG-svH3js,80
|
|
120
|
+
pimm/models/panda/detector/layers.py,sha256=IHwkZZ_Pbq3h27ByTIkO2Pg67NI4McUa6fRI2i12Re4,12165
|
|
121
|
+
pimm/models/panda/detector/matcher.py,sha256=MT_JNagv4ZmV8Ynvao70K4A-uWW9FJ5iReotUF_carU,11044
|
|
122
|
+
pimm/models/panda/detector/panda_detector_v2m1.py,sha256=wMv-8mmyH4POdVhKh-mK4sUhKt9a6COSpd8VtARbviA,36672
|
|
123
|
+
pimm/models/panda/detector/postprocess.py,sha256=x1Nmj49fkWOsSbDjS14qs7w4HYkwcBFb8Jqf80ctnV0,22085
|
|
124
|
+
pimm/models/panda/encoder/__init__.py,sha256=nivvBZPxNz_3NHABVVDxXYbNQSJivIRu40zJ0bs4MIQ,77
|
|
125
|
+
pimm/models/panda/encoder/panda_encoder_v2m1.py,sha256=SHqOIf1X0pSMizYZx0dhY__-e9nsmY9K84R5YoNKPw8,12597
|
|
126
|
+
pimm/models/panda/pretrain/__init__.py,sha256=6_V8EcODj3l7_zOrSsg5p_OOZkhLpw7WdKh63u10kLE,91
|
|
127
|
+
pimm/models/panda/pretrain/panda_ssl_v2m1.py,sha256=qheHXhXA7JfYLNdT6aEvEHM9KGXNj3bNs7vyIqSgiOo,23765
|
|
128
|
+
pimm/models/panda_detector/__init__.py,sha256=TdNz86XtkV9xYZ2fOzYwSy0OlR3IZ7yPfBMEHRbLau0,49
|
|
129
|
+
pimm/models/panda_detector/layers.py,sha256=H2eGURBS9BykYdomGlGgAtvDwmCMrRixAAejjtGzD8E,21177
|
|
130
|
+
pimm/models/panda_detector/matcher_fast.py,sha256=F1J_3dQw12c-sY9dU3X-Ex43B6nxudJrqf9x8zCy2Ic,10440
|
|
131
|
+
pimm/models/panda_detector/panda_detector_v1m1.py,sha256=An3C5vStJSWTtRv1GrR0e4aKnhNLbduQs2MX0l5qgnc,27922
|
|
132
|
+
pimm/models/panda_detector/postprocess.py,sha256=818OSU21yCGlca8u6QsmkV4Zno1XP0s99jmumgyef84,19862
|
|
133
|
+
pimm/models/point_transformer_v3/__init__.py,sha256=SOT14eYVQnGXljx0hc3oLDg3nWakqVSEo-EYpMs-GG8,126
|
|
134
|
+
pimm/models/point_transformer_v3/point_transformer_v3m1_base.py,sha256=XQNqAqaVOfGACWTcCUY6ktasalKVDWghualBKqpkm-0,25494
|
|
135
|
+
pimm/models/point_transformer_v3/point_transformer_v3m2_sonata.py,sha256=tkXtnBtpB3bQe4Wm3noB2CFnGAvfskBuAfmIYtU66YA,31548
|
|
136
|
+
pimm/models/point_transformer_v3/point_transformer_v3m8.py,sha256=MKbyXfLm-EgtwPO1XI6SgWESXgNIVp4SXcctlCdfATA,35631
|
|
137
|
+
pimm/models/polarmae/__init__.py,sha256=Ot-rZamdbdtoGhAD3UOOponuux6OqG9ZY76vmUwE7qY,55
|
|
138
|
+
pimm/models/polarmae/data.py,sha256=t2dIfxm95TuEC7Nb5y2kiEsjzVfKblhmnqoOTLm3Q9s,1751
|
|
139
|
+
pimm/models/polarmae/layers.py,sha256=GePCWJj9DfMqP9SMHb3gWLOUH57X5MNhQEVTQB2Va9Y,25467
|
|
140
|
+
pimm/models/polarmae/ops.py,sha256=Ya5m8o5-4g-Axug6G3dcBXFWTcsxs7YZx_Mnl4qKSjE,13492
|
|
141
|
+
pimm/models/polarmae/polarmae.py,sha256=Lxtc2wLM89KX1_bS3bc3xR4W1VJFkw3DKRFENEBfKcw,9350
|
|
142
|
+
pimm/models/polarmae/polarmae_semseg.py,sha256=UY31FcjKXSiSwvdIfFyTCvPkYFm3yh3Snet0OwJ2hsY,9501
|
|
143
|
+
pimm/models/sonata/__init__.py,sha256=6c5eurSavHfoWjt5q0KN-JjyO7nLOyn--39vtoWAKlU,114
|
|
144
|
+
pimm/models/sonata/sonata_v1m1_base.py,sha256=p34bUj2JhPsb5_Fuv95XXomGVcD5FrHamhTLo7R2FNQ,25872
|
|
145
|
+
pimm/models/sonata/sonata_v1m2_uni_teacher_head.py,sha256=KD5aEUuMTc5wvFY1IZfa7BO2ci0ZKmwMkfFWhM3MsIo,20935
|
|
146
|
+
pimm/models/sparse_unet/__init__.py,sha256=qDa4rcgz9po3iC0_lFJ8McTaFtj5fcyMCrTn-DmMwJ8,145
|
|
147
|
+
pimm/models/sparse_unet/mink_unet.py,sha256=QhiuBo1lvMzuQChQcWxMGFvdGH5p5lXOzP26ixgBnHw,12526
|
|
148
|
+
pimm/models/sparse_unet/spconv_unet_v1m1_base.py,sha256=AoqWu7C2Frr_ArnoGvAx1_3yJ_JdMF-mrWUH7qZRs4E,15499
|
|
149
|
+
pimm/models/sparse_unet/spconv_unet_v1m2_bn_momentum.py,sha256=pq9JZBzlDJhfAqPbfm585xYI4xyCNiQ59BId0gQ-9w0,9032
|
|
150
|
+
pimm/models/sparse_unet/spconv_unet_v1m3_pdnorm.py,sha256=VRnN1ouQgJ-FSLeTdQciDXctgxv8YKNVdj4eSySvTOY,13831
|
|
151
|
+
pimm/models/utils/__init__.py,sha256=lVT1V35ilJUOCWM5k68DadVLXh0QyFgHEWXFGwULbXE,217
|
|
152
|
+
pimm/models/utils/checkpoint.py,sha256=QGL8s1YqZp2Z2bj_s6O5jgfJxsb2ND4FXH0lC-Cyyt4,3598
|
|
153
|
+
pimm/models/utils/checkpoint_loader.py,sha256=hadIotCejCnCT-Wt-9xOhOi00L7koFVMSvx68OkaMP0,166
|
|
154
|
+
pimm/models/utils/hierarchical_features.py,sha256=m9h2dx3-m69tXsbxUCgExiqBglxyLzoRw44fqAgT1J4,10541
|
|
155
|
+
pimm/models/utils/misc.py,sha256=NeWJ52PoLHa8u6IztAvPgJa2610dflVrR2okgpa2E6Q,2599
|
|
156
|
+
pimm/models/utils/stats.py,sha256=fFZtKhWsXWZFysYuBxrxXDE0ah2s1Mum75ro8hsCQk8,2634
|
|
157
|
+
pimm/models/utils/structure.py,sha256=73BBu_eLDpfrdHJNaEsJzSL15ATxymj3xK6jCzO67uc,9761
|
|
158
|
+
pimm/models/utils/serialization/__init__.py,sha256=hSfeuQVzqjH8N5BGP6BBojTpE7SqP2faCp2UmxokDDM,233
|
|
159
|
+
pimm/models/utils/serialization/default.py,sha256=K5gzXfUTOqDoX1t0rb6rykV98lMhCKAeps_Kp2g9PYM,5548
|
|
160
|
+
pimm/models/utils/serialization/hilbert.py,sha256=Y3iUTa9hUyXRRrfklfWTwmTtSjU6TPKKysa0a5QBBEU,12561
|
|
161
|
+
pimm/models/utils/serialization/z_order.py,sha256=ijsfUWw14DyhXLU7EMCbi5y-dSiaxYZQtkiSEuklLCE,4135
|
|
162
|
+
pimm/observability/__init__.py,sha256=1ARj0wRILlAe0NeSp98KGtLMeOm8sJGzocLY3198e9I,130
|
|
163
|
+
pimm/observability/structured_logger/LICENSE,sha256=buowmVlBEmvuuZ73dfCWjtgyC-tINK0o1q5nBKGpKTA,1495
|
|
164
|
+
pimm/observability/structured_logger/README.md,sha256=rgeOB5zodx759m7H6S66hWLPSD2sGybfQbc41kA8QzM,6860
|
|
165
|
+
pimm/observability/structured_logger/__init__.py,sha256=pqFOBW49PSlfMWoHLbVdm_U5tbaOXnV6g0Gcm4YXl8c,1362
|
|
166
|
+
pimm/observability/structured_logger/gantt_generator.py,sha256=sx4gQMKrJGEaElE_3JG-SLjQ8hks_ICr1GEgWZKHVlQ,21640
|
|
167
|
+
pimm/observability/structured_logger/jsonl_handler.py,sha256=vM3dJDQ9syThExV9dqksKnJkrvodgMrtuX2KRVQOlpI,10716
|
|
168
|
+
pimm/observability/structured_logger/step_state.py,sha256=4XAL4icW-s4H_0IW36mhOvYUBUQlivFo9egc30U4HH0,6750
|
|
169
|
+
pimm/observability/structured_logger/structured_logging.py,sha256=SxtkXf9wntIIjI7F9ftBqUmTZzZBcFpEgcmd5Ll-QwI,19511
|
|
170
|
+
pimm/ops/README.md,sha256=9PvaRV78J-YSwoml6Ql1iijGAcRJTL6adAszD274eLc,9681
|
|
171
|
+
pimm/ops/__init__.py,sha256=-ECrrtgXVETO1vR174R9VM0rjvbzBxXdP6yigZnMO0M,479
|
|
172
|
+
pimm/ops/_attention_turing.py,sha256=D_Vxm1eaY0PJL9kuWQxFRlncRYDVsM4n80Px_6wMhgM,2683
|
|
173
|
+
pimm/ops/_fused.py,sha256=yGk5TozekcgqpKf5T0X2LDLS-loftgfeyFUFEAWb_NM,357
|
|
174
|
+
pimm/ops/attention.py,sha256=HELbnjloCR1niXZYEhVmZ70Y33fJXfm4Y-NKv9GwQvU,12871
|
|
175
|
+
pimm/ops/hilbert.py,sha256=n3tKWCvn4ncIrjoKPtjznXSGQJ0N94Ds4V9CrN1S2D0,537
|
|
176
|
+
pimm/ops/knn.py,sha256=bWoQVEafR2FCFhejTio9v3rAdSOOg0OyOUBnmMHYMAg,3517
|
|
177
|
+
pimm/ops/rope.py,sha256=1kZlmb7NZOvtc6JdHJP8P4W5I9eV6Nn8xC9HuuhRc1A,658
|
|
178
|
+
pimm/ops/sinkhorn.py,sha256=hnvAfHfKf6_b2ziAjHeaeGhCdRfS1n5OSZ_Kn56rAnw,4531
|
|
179
|
+
pimm/ops/submconv3d.py,sha256=pRDn8qu9FxjViAB5L-QrunMJ34ED7KRwka5FTXb8uT0,7419
|
|
180
|
+
pimm/ops/triton/__init__.py,sha256=W7aZS_sqPoITl0p7z8yC35oig7RUzmvKaO8A89jz6xg,246
|
|
181
|
+
pimm/ops/triton/attention.py,sha256=cOo5KRkzJu5SXndjBS-GyaTvPp7DNP88KT8aqc5hHu8,13835
|
|
182
|
+
pimm/ops/triton/ball_query.py,sha256=p8Zu8MOXZxACI9cPLub9EoN3zjTdyr8V059rgqN45rg,3488
|
|
183
|
+
pimm/ops/triton/cnms.py,sha256=RiAwLCl25hueCfRInozdsyezkf-Gj3tEydnFwfzQJUM,2670
|
|
184
|
+
pimm/ops/triton/fps.py,sha256=qDVKMJnOP9CifSSmYnIrz7SM2KycprXQllAG7yG7OI0,3629
|
|
185
|
+
pimm/ops/triton/hilbert.py,sha256=GAJ-XISY8ynS__vM6LT0h3J4tx_9kbs0P2bF19P44_8,2536
|
|
186
|
+
pimm/ops/triton/knn.py,sha256=JUEt_5rk5XXXObxGIdCcMtrDeSJyzDdNVFf0jlP8dhE,4092
|
|
187
|
+
pimm/ops/triton/knn_points.py,sha256=7S-gSjpHg6Oqdvto6BtTqvrhK6yH-jKnlAyrXC0NiRI,8099
|
|
188
|
+
pimm/ops/triton/sinkhorn.py,sha256=LZVoD5cU1pNqvQWPCTJvFLtvElYXhtIF_v7_b7aokfQ,21580
|
|
189
|
+
pimm/ops/triton/submconv3d.py,sha256=qnvD6sgADxRrJisLGUxdxeaOGuaBn_IufxKnN1-c6N8,13877
|
|
190
|
+
pimm/ops/triton/window_attention.py,sha256=3LT5GoP6lCkgHnCz3s9tIB9FPzXly2_-fkC0VgktOWg,8985
|
|
191
|
+
pimm/utils/__init__.py,sha256=gpTj4D7e8smRfYrvtcml2FHAYjCBIQ_wDbFDiXOzK8w,350
|
|
192
|
+
pimm/utils/cache.py,sha256=gA6pBXDhoQdSD0Hmz1MzWYuQTi2ij1OnnygJDeLysZs,2008
|
|
193
|
+
pimm/utils/checkpoints.py,sha256=tldzLc31zSPuYDodHs_a_56lcNlPy-mgqRJ6l9eAOA4,58441
|
|
194
|
+
pimm/utils/comm.py,sha256=gT8gHkUIeTfmjc6a027pLhWAxzUMaEUn9YN7XHVF4hY,15511
|
|
195
|
+
pimm/utils/config.py,sha256=Dr1tZ1HVgF4qRXSCGLzPFwP4TBTOtpCrjtxnXrSBVPM,29856
|
|
196
|
+
pimm/utils/env.py,sha256=Vbjqerfh1TMEJ1Z3QNsjD3OdITG8n9qXopGpymZCXgo,1538
|
|
197
|
+
pimm/utils/events.py,sha256=HVkq6f-Ae158Ohvt3OmGsgyBCX1Vv5YQkm5KTqSCd4w,37402
|
|
198
|
+
pimm/utils/logger.py,sha256=e_aoqqX8XEP8VCzCk666l4BqBQ3vWHtLTZsUKnepu1s,5743
|
|
199
|
+
pimm/utils/misc.py,sha256=C4hBL6t9N2uHdumjxNg2mpO0MhRyao-I877dTUKC0lg,4793
|
|
200
|
+
pimm/utils/optimizer.py,sha256=1P80xczI2mtYMFD67U4YdgtIEWBzTFRXAaC2hafAx80,2661
|
|
201
|
+
pimm/utils/path.py,sha256=otkhZUFEa-nhUlZnjfy8uwfvEUkZx9j6XlnilFbvz-8,5971
|
|
202
|
+
pimm/utils/registry.py,sha256=Is4b4YQP1QtJJvu093rDZbHn-j8LEynrAKd51wZkiBY,12465
|
|
203
|
+
pimm/utils/scheduler.py,sha256=mFRcIzolNpuglToasQ1cS3YHs5MXhz-ELxtgMFtg4Fg,7087
|
|
204
|
+
pimm/utils/timer.py,sha256=zJbsUJs-ZK225KUs7jj0O0gwdKOhEeTByngC1Mxgbzg,2081
|
|
205
|
+
pimm/utils/visualization.py,sha256=BIPxUQoRFjg1lIHrGUCHkznafiitztPH0hdyArgR22c,4109
|
|
206
|
+
pimm/utils/warnings.py,sha256=FVeCCRaxagQCsK6YMYCIO0iu5ig3Ijoq9g742rIo2Rw,2322
|
|
207
|
+
particle_imaging_models-0.6.0.dist-info/METADATA,sha256=KF1g2G0w1V33MNqgYP8GUr1tzC62Lxs5j0g_KB3XxK0,12946
|
|
208
|
+
particle_imaging_models-0.6.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
209
|
+
particle_imaging_models-0.6.0.dist-info/entry_points.txt,sha256=GX6DBlHdhJVQjrt7ghGc_rb59H0huJFZtSkNFQjfCyQ,44
|
|
210
|
+
particle_imaging_models-0.6.0.dist-info/licenses/LICENSE,sha256=C8EPQv7xdpDTUf_9jVRtFPG9b6Uer0Hz0DzUrUhbOkM,1061
|
|
211
|
+
particle_imaging_models-0.6.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 pimm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pimm/__init__.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""pimm — particle imaging models!
|
|
2
|
+
|
|
3
|
+
Author: Samuel Young
|
|
4
|
+
Email: youngsam@stanford.edu
|
|
5
|
+
|
|
6
|
+
Please cite this codebase if you find it useful.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Silence a benign pydantic>=2.11 warning emitted at import time by wandb's
|
|
10
|
+
# auto-generated GraphQL models (they set Field(repr=False)/Field(frozen=True) on
|
|
11
|
+
# Annotated aliases, which pydantic ignores). Installed before any wandb import.
|
|
12
|
+
import warnings as _warnings
|
|
13
|
+
|
|
14
|
+
_warnings.filterwarnings(
|
|
15
|
+
"ignore",
|
|
16
|
+
message=r".*attribute with value .* was provided to the `Field\(\)` function",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
# Lazily expose the high-level model IO helpers as `pimm.from_pretrained`, etc.,
|
|
20
|
+
# without importing the (heavier) export stack at `import pimm` time.
|
|
21
|
+
_EXPORT_API = {"from_pretrained", "save_pretrained", "push_to_hub"}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def __getattr__(name):
|
|
25
|
+
if name in _EXPORT_API:
|
|
26
|
+
from pimm import export
|
|
27
|
+
|
|
28
|
+
return getattr(export, name)
|
|
29
|
+
raise AttributeError(f"module 'pimm' has no attribute {name!r}")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def __dir__():
|
|
33
|
+
return sorted(list(globals()) + list(_EXPORT_API))
|
pimm/cli/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Command-line entrypoints for pimm."""
|
pimm/cli/__main__.py
ADDED
pimm/cli/common.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Shared helpers for Tyro CLI launch commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TypeVar
|
|
6
|
+
|
|
7
|
+
import tyro
|
|
8
|
+
|
|
9
|
+
from pimm.launch.compat import normalize_legacy_cli
|
|
10
|
+
from pimm.launch.config import load_config
|
|
11
|
+
from pimm.launch.schema import LaunchCommand, LaunchConfig
|
|
12
|
+
|
|
13
|
+
CommandT = TypeVar("CommandT", bound=LaunchCommand)
|
|
14
|
+
SECRET_OPTION_PARTS = ("api-key", "token", "secret", "password", "passwd", "credential")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def redact_cli_argv(argv: list[str]) -> list[str]:
|
|
18
|
+
"""Replace secret CLI values before recording a reproducible command."""
|
|
19
|
+
result = []
|
|
20
|
+
redact_next = False
|
|
21
|
+
for arg in argv:
|
|
22
|
+
if redact_next:
|
|
23
|
+
result.append("<redacted>")
|
|
24
|
+
redact_next = False
|
|
25
|
+
continue
|
|
26
|
+
option, separator, _ = arg.partition("=")
|
|
27
|
+
normalized = option.lower().replace("_", "-")
|
|
28
|
+
if option.startswith("--") and any(
|
|
29
|
+
part in normalized for part in SECRET_OPTION_PARTS
|
|
30
|
+
):
|
|
31
|
+
result.append(f"{option}=<redacted>" if separator else option)
|
|
32
|
+
redact_next = not separator
|
|
33
|
+
else:
|
|
34
|
+
result.append(arg)
|
|
35
|
+
return result
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def split_training_tail(argv: list[str]) -> tuple[list[str], list[str]]:
|
|
39
|
+
"""Split Tyro launcher args from schema-free training config overrides."""
|
|
40
|
+
if "--" not in argv:
|
|
41
|
+
return argv, []
|
|
42
|
+
index = argv.index("--")
|
|
43
|
+
return argv[:index], argv[index + 1 :]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def bootstrap_value(argv: list[str], name: str) -> str | None:
|
|
47
|
+
"""Read a simple `--name value` or `--name=value` selector before Tyro."""
|
|
48
|
+
prefix = f"--{name}="
|
|
49
|
+
for index, arg in enumerate(argv):
|
|
50
|
+
if arg.startswith(prefix):
|
|
51
|
+
return arg.split("=", 1)[1]
|
|
52
|
+
if arg == f"--{name}" and index + 1 < len(argv):
|
|
53
|
+
return argv[index + 1]
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def parse_typed_command(
|
|
58
|
+
command_type: type[CommandT],
|
|
59
|
+
argv: list[str],
|
|
60
|
+
*,
|
|
61
|
+
launch_timestamp: str,
|
|
62
|
+
prog: str,
|
|
63
|
+
default_site: str = "local",
|
|
64
|
+
) -> tuple[CommandT, list[str]]:
|
|
65
|
+
"""Parse a Tyro command after loading site/recipe defaults."""
|
|
66
|
+
tyro_args, training_overrides = split_training_tail(argv)
|
|
67
|
+
tyro_args = normalize_legacy_cli(tyro_args)
|
|
68
|
+
if not tyro_args:
|
|
69
|
+
tyro_args = ["--help"]
|
|
70
|
+
site = bootstrap_value(tyro_args, "site") or default_site
|
|
71
|
+
recipe = bootstrap_value(tyro_args, "recipe")
|
|
72
|
+
base_cfg = load_config(site=site, recipe=recipe, launch_timestamp=launch_timestamp)
|
|
73
|
+
default = command_type.from_config(LaunchConfig.from_dict(base_cfg), recipe=recipe)
|
|
74
|
+
command = tyro.cli(
|
|
75
|
+
command_type,
|
|
76
|
+
args=tyro_args,
|
|
77
|
+
default=default,
|
|
78
|
+
prog=prog,
|
|
79
|
+
)
|
|
80
|
+
return command, training_overrides
|