salt-ml 0.6__tar.gz
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.
- salt_ml-0.6/LICENSE +7 -0
- salt_ml-0.6/PKG-INFO +31 -0
- salt_ml-0.6/README.md +7 -0
- salt_ml-0.6/pyproject.toml +57 -0
- salt_ml-0.6/requirements.txt +27 -0
- salt_ml-0.6/salt/__init__.py +1 -0
- salt_ml-0.6/salt/main.py +31 -0
- salt_ml-0.6/salt/modelwrapper.py +252 -0
- salt_ml-0.6/salt/stypes.py +8 -0
- salt_ml-0.6/salt_ml.egg-info/PKG-INFO +31 -0
- salt_ml-0.6/salt_ml.egg-info/SOURCES.txt +14 -0
- salt_ml-0.6/salt_ml.egg-info/dependency_links.txt +1 -0
- salt_ml-0.6/salt_ml.egg-info/entry_points.txt +8 -0
- salt_ml-0.6/salt_ml.egg-info/requires.txt +22 -0
- salt_ml-0.6/salt_ml.egg-info/top_level.txt +1 -0
- salt_ml-0.6/setup.cfg +4 -0
salt_ml-0.6/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2024 CERN
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
salt_ml-0.6/PKG-INFO
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: salt-ml
|
|
3
|
+
Version: 0.6
|
|
4
|
+
Summary: Multimodal and Multiclass Machine Learning for High Energy Physics
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt
|
|
7
|
+
Project-URL: Issue Tracker, https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt/-/issues
|
|
8
|
+
Requires-Python: <3.12,>=3.10
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pytest==7.4.2
|
|
11
|
+
Requires-Dist: pytest-cov==4.1.0
|
|
12
|
+
Requires-Dist: comet_ml==3.35.3
|
|
13
|
+
Requires-Dist: tqdm==4.66.1
|
|
14
|
+
Requires-Dist: rich==13.6.0
|
|
15
|
+
Requires-Dist: pre-commit==3.5.0
|
|
16
|
+
Requires-Dist: ruff==0.2.2
|
|
17
|
+
Requires-Dist: h5py==3.10.0
|
|
18
|
+
Requires-Dist: numpy==1.24.2
|
|
19
|
+
Requires-Dist: torch==2.2.1
|
|
20
|
+
Requires-Dist: lightning==2.2.0
|
|
21
|
+
Requires-Dist: jsonargparse[all]==4.32.0
|
|
22
|
+
Requires-Dist: torchmetrics==1.2.1
|
|
23
|
+
Requires-Dist: onnx==1.16.0
|
|
24
|
+
Requires-Dist: onnxruntime==1.15.1
|
|
25
|
+
Requires-Dist: atlas-ftag-tools==0.2.2
|
|
26
|
+
Requires-Dist: scipy==1.12.0
|
|
27
|
+
Requires-Dist: mup==1.0.0
|
|
28
|
+
Requires-Dist: boto3==1.28.17
|
|
29
|
+
Requires-Dist: s3fs==2023.9.2
|
|
30
|
+
Requires-Dist: s3path==0.5.0
|
|
31
|
+
Requires-Dist: tensorboard==2.14.1
|
salt_ml-0.6/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[](https://ftag-salt.docs.cern.ch/)
|
|
2
|
+
|
|
3
|
+
# Salt
|
|
4
|
+
|
|
5
|
+
This is the home of Salt, a framework for training multi-model and multi-task models models in the style of GN2.
|
|
6
|
+
|
|
7
|
+
Documentation is available [here](https://ftag-salt.docs.cern.ch/).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "salt-ml"
|
|
3
|
+
description = "Multimodal and Multiclass Machine Learning for High Energy Physics"
|
|
4
|
+
license = {text = "MIT"}
|
|
5
|
+
requires-python = ">=3.10,<3.12"
|
|
6
|
+
dynamic = ["version", "dependencies"]
|
|
7
|
+
|
|
8
|
+
[project.urls]
|
|
9
|
+
"Homepage" = "https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt"
|
|
10
|
+
"Issue Tracker" = "https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt/-/issues"
|
|
11
|
+
|
|
12
|
+
[project.scripts]
|
|
13
|
+
salt = "salt.main:main"
|
|
14
|
+
to_onnx = "salt.onnx.to_onnx:main"
|
|
15
|
+
get_onnx_metadata = "salt.utils.get_onnx_metadata:main"
|
|
16
|
+
compare_models = "salt.utils.compare_models:main"
|
|
17
|
+
repair_ckpt = "salt.utils.repair_ckpt:main"
|
|
18
|
+
setup_muP = "salt.utils.muP_utils.main_muP:main"
|
|
19
|
+
download_S3 = "salt.utils.file_utils:download_from_S3"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools]
|
|
22
|
+
packages = ["salt"]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.dynamic]
|
|
25
|
+
dependencies = {file = ["requirements.txt"]}
|
|
26
|
+
version = {attr = "salt.__version__"}
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["setuptools>=62"]
|
|
30
|
+
build-backend = "setuptools.build_meta"
|
|
31
|
+
|
|
32
|
+
[tool.ruff]
|
|
33
|
+
line-length = 100
|
|
34
|
+
preview = true
|
|
35
|
+
lint.select = ["ALL", "D212", "D417"]
|
|
36
|
+
lint.ignore = [
|
|
37
|
+
"COM", "D100", "D101", "D102", "D103", "D104", "D105", "D205", "D401", "EM", "FIX", "FBT",
|
|
38
|
+
"S101", "S404", "S602", "PLR2004", "PLR0912", "PLR0913", "PLR0914", "PLR0915", "PLR0917",
|
|
39
|
+
"PLC0415", "G004", "PD901", "N802", "C901", "DTZ005", "DTZ007", "INP", "EXE002", "TD002",
|
|
40
|
+
"ANN001", "ANN002", "ANN003", "ANN101", "ANN201", "ANN202", "ANN204", "CPY001", "TRY003", "PLR1702",
|
|
41
|
+
"N803", "N806", "N812", "T201", "PLW1514", "PTH123", "RUF015", "RUF017", "PLR6301", "ERA", "ISC001",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[tool.ruff.lint.pydocstyle]
|
|
45
|
+
convention = "numpy"
|
|
46
|
+
|
|
47
|
+
[tool.ruff.lint.flake8-pytest-style]
|
|
48
|
+
fixture-parentheses = false
|
|
49
|
+
mark-parentheses = false
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
log_cli = true
|
|
53
|
+
log_cli_level = "CRITICAL"
|
|
54
|
+
filterwarnings = ["ignore::DeprecationWarning"]
|
|
55
|
+
|
|
56
|
+
[tool.coverage.report]
|
|
57
|
+
omit = ["**/muP_utils/*"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# infra
|
|
2
|
+
pytest==7.4.2
|
|
3
|
+
pytest-cov==4.1.0
|
|
4
|
+
comet_ml==3.35.3
|
|
5
|
+
tqdm==4.66.1
|
|
6
|
+
rich==13.6.0
|
|
7
|
+
pre-commit==3.5.0
|
|
8
|
+
ruff==0.2.2
|
|
9
|
+
|
|
10
|
+
# core
|
|
11
|
+
h5py==3.10.0
|
|
12
|
+
numpy==1.24.2
|
|
13
|
+
torch==2.2.1
|
|
14
|
+
lightning==2.2.0
|
|
15
|
+
jsonargparse[all]==4.32.0
|
|
16
|
+
torchmetrics==1.2.1
|
|
17
|
+
onnx==1.16.0
|
|
18
|
+
onnxruntime==1.15.1
|
|
19
|
+
atlas-ftag-tools==0.2.2
|
|
20
|
+
scipy==1.12.0
|
|
21
|
+
|
|
22
|
+
# S3 and muTransfer
|
|
23
|
+
mup==1.0.0
|
|
24
|
+
boto3==1.28.17
|
|
25
|
+
s3fs==2023.9.2
|
|
26
|
+
s3path==0.5.0
|
|
27
|
+
tensorboard==2.14.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6"
|
salt_ml-0.6/salt/main.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Top level training script, powered by the lightning CLI."""
|
|
2
|
+
|
|
3
|
+
import pathlib
|
|
4
|
+
|
|
5
|
+
import comet_ml # noqa: F401
|
|
6
|
+
from lightning.pytorch.cli import ArgsType
|
|
7
|
+
|
|
8
|
+
from salt.callbacks import SaveConfigCallback
|
|
9
|
+
from salt.data.datamodules import SaltDataModule
|
|
10
|
+
from salt.modelwrapper import ModelWrapper
|
|
11
|
+
from salt.utils.cli import SaltCLI
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main(args: ArgsType = None) -> None:
|
|
15
|
+
config_dir = pathlib.Path(__file__).parent / "configs"
|
|
16
|
+
|
|
17
|
+
SaltCLI(
|
|
18
|
+
model_class=ModelWrapper,
|
|
19
|
+
datamodule_class=SaltDataModule,
|
|
20
|
+
save_config_callback=SaveConfigCallback,
|
|
21
|
+
args=args,
|
|
22
|
+
parser_kwargs={
|
|
23
|
+
"default_env": True,
|
|
24
|
+
"fit": {"default_config_files": [f"{config_dir}/base.yaml"]},
|
|
25
|
+
"test": {"default_config_files": [f"{config_dir}/base.yaml"]},
|
|
26
|
+
},
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import warnings
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
|
|
5
|
+
import lightning as L
|
|
6
|
+
import torch
|
|
7
|
+
from torch import nn
|
|
8
|
+
|
|
9
|
+
from salt.models import InputNorm
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def check_unique(modules: nn.ModuleList, attr_name: str) -> None:
|
|
13
|
+
assert len({getattr(m, attr_name) for m in modules}) == len(
|
|
14
|
+
modules
|
|
15
|
+
), f"Attribute '{attr_name}' must be unique for class {modules[0].__class__.__name__}"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ModelWrapper(L.LightningModule):
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
model: nn.Module,
|
|
22
|
+
lrs_config: Mapping[str, float],
|
|
23
|
+
global_object: str,
|
|
24
|
+
norm_config: dict | None = None,
|
|
25
|
+
name: str = "salt",
|
|
26
|
+
muP_config: dict | None = None,
|
|
27
|
+
loss_mode: str = "wsum",
|
|
28
|
+
):
|
|
29
|
+
"""A wrapper class for any model implemented in Salt.
|
|
30
|
+
|
|
31
|
+
This wrapper class allows is as generic as possible. It wraps
|
|
32
|
+
[`SaltModel`][salt.models.SaltModel], but could also be used to
|
|
33
|
+
wrap any other model if you want to do train something that doesn't
|
|
34
|
+
fit into the [`SaltModel`][salt.models.SaltModel] architecture.
|
|
35
|
+
|
|
36
|
+
This class is responsible for containing things that are common to all
|
|
37
|
+
salt models. These are:
|
|
38
|
+
|
|
39
|
+
- A generic forward pass, including input normalisation
|
|
40
|
+
- Training, validation and test steps, which include logging
|
|
41
|
+
- Some sanity checks on the model configuration
|
|
42
|
+
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
model : nn.Module
|
|
46
|
+
Model to be wrapped
|
|
47
|
+
lrs_config: Mapping
|
|
48
|
+
LRS config which has to be set manually for now
|
|
49
|
+
https://github.com/omni-us/jsonargparse/issues/170#issuecomment-1288167674
|
|
50
|
+
global_object : str
|
|
51
|
+
Name of the global input object, as opposed to the constituent-level
|
|
52
|
+
inputs. This argument is set automatically by the framework.
|
|
53
|
+
norm_config : dict, optional
|
|
54
|
+
Keyword arguments for [`salt.models.InputNorm`][salt.models.InputNorm].
|
|
55
|
+
name: str, optional
|
|
56
|
+
Name of the model, used for logging and inference output names
|
|
57
|
+
muP_config: dict, optional
|
|
58
|
+
The muP configuration.
|
|
59
|
+
loss_mode: str, optional
|
|
60
|
+
The loss mode to use. Default is "wsum" (weighted sum).
|
|
61
|
+
Other options are
|
|
62
|
+
- 'GLS' : arxiv.org/1904.08492
|
|
63
|
+
"""
|
|
64
|
+
super().__init__()
|
|
65
|
+
with warnings.catch_warnings():
|
|
66
|
+
warnings.simplefilter("ignore")
|
|
67
|
+
self.save_hyperparameters(logger=False)
|
|
68
|
+
|
|
69
|
+
self.model = model
|
|
70
|
+
self.lrs_config = lrs_config
|
|
71
|
+
self.global_object = global_object
|
|
72
|
+
self.name = name
|
|
73
|
+
self.muP = muP_config or {}
|
|
74
|
+
self.last_val_batch_outs = None
|
|
75
|
+
# Here the model should pick it up
|
|
76
|
+
if self.muP:
|
|
77
|
+
from salt.utils.muP_utils.configuration_muP import instantiate_mup
|
|
78
|
+
|
|
79
|
+
load_path = None
|
|
80
|
+
if "shape_path" in self.muP:
|
|
81
|
+
load_path = self.muP["shape_path"]
|
|
82
|
+
instantiate_mup(model, load_path)
|
|
83
|
+
|
|
84
|
+
# all tasks should inherit the global object type and model name
|
|
85
|
+
self.model.global_object = self.global_object
|
|
86
|
+
for task in self.model.tasks:
|
|
87
|
+
task.global_object = self.global_object
|
|
88
|
+
task.model_name = self.name
|
|
89
|
+
|
|
90
|
+
# ensure unique names for init_nets and tasks
|
|
91
|
+
check_unique(self.model.init_nets, "input_name")
|
|
92
|
+
check_unique(self.model.tasks, "name")
|
|
93
|
+
|
|
94
|
+
# check that the model has the same output size for all init nets
|
|
95
|
+
assert len({t.net.output_size for t in self.model.init_nets if t.input_name != "EDGE"}) == 1
|
|
96
|
+
|
|
97
|
+
# create input normaliser
|
|
98
|
+
assert norm_config is not None
|
|
99
|
+
self.norm = InputNorm(**norm_config)
|
|
100
|
+
allowed_loss_modes = ["wsum", "GLS"]
|
|
101
|
+
assert loss_mode in allowed_loss_modes, f"Loss mode must be one of {allowed_loss_modes}"
|
|
102
|
+
self.loss_mode = loss_mode
|
|
103
|
+
if loss_mode == "GLS":
|
|
104
|
+
assert all(
|
|
105
|
+
task.weight == 1.0 for task in self.model.tasks
|
|
106
|
+
), "GLS does not utilise task weights - remove all/set to 1"
|
|
107
|
+
|
|
108
|
+
def total_loss(self, loss: dict):
|
|
109
|
+
"""Computes the final loss based on the loss mode."""
|
|
110
|
+
if self.loss_mode == "GLS":
|
|
111
|
+
# Calculate the geometric mean of the losses
|
|
112
|
+
loss_prod = math.prod(subloss for subloss in loss.values())
|
|
113
|
+
return torch.pow(loss_prod, 1.0 / len(loss))
|
|
114
|
+
|
|
115
|
+
# Return the default weighted sum
|
|
116
|
+
return sum(subloss for subloss in loss.values())
|
|
117
|
+
|
|
118
|
+
def forward(self, inputs, pad_masks=None, labels=None):
|
|
119
|
+
"""Generic forward pass through any salt-compatible model.
|
|
120
|
+
|
|
121
|
+
This function performs input normalisation and then calls the `self.model`'s
|
|
122
|
+
forward pass. Don't call this method directy, instead use `__call__`.
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
inputs
|
|
127
|
+
Any generic input to the model.
|
|
128
|
+
pad_masks
|
|
129
|
+
Input padding masks.
|
|
130
|
+
labels
|
|
131
|
+
Training targets. If not specified, assume we are running model inference
|
|
132
|
+
(i.e. no loss computation).
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
Whatever is returned by `self.model`'s forward pass.
|
|
137
|
+
"""
|
|
138
|
+
x = self.norm(inputs)
|
|
139
|
+
return self.model(x, pad_masks, labels)
|
|
140
|
+
|
|
141
|
+
def shared_step(self, batch, evaluation=False):
|
|
142
|
+
"""Function used to unpack the batch, run the forward pass, and compute
|
|
143
|
+
losses, used by training, validation and test steps.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
batch : tuple
|
|
148
|
+
A single batch of inputs, pad_masks and labels
|
|
149
|
+
evaluation : bool
|
|
150
|
+
If true, don't compute the losses and return early
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
preds
|
|
155
|
+
Model predictions
|
|
156
|
+
labels
|
|
157
|
+
True labels
|
|
158
|
+
loss
|
|
159
|
+
Reduced loss over the input batch
|
|
160
|
+
"""
|
|
161
|
+
# unpack the batch
|
|
162
|
+
inputs, pad_masks, labels = batch
|
|
163
|
+
|
|
164
|
+
# forward pass through model
|
|
165
|
+
preds, loss = self(inputs, pad_masks, labels)
|
|
166
|
+
|
|
167
|
+
if evaluation:
|
|
168
|
+
return preds, labels, pad_masks, None
|
|
169
|
+
|
|
170
|
+
# compute total loss
|
|
171
|
+
loss["loss"] = self.total_loss(loss)
|
|
172
|
+
|
|
173
|
+
return preds, labels, pad_masks, loss
|
|
174
|
+
|
|
175
|
+
def log_losses(self, loss, stage):
|
|
176
|
+
kwargs = {"sync_dist": len(self.trainer.device_ids) > 1}
|
|
177
|
+
self.log(f"{stage}_loss", loss["loss"], **kwargs)
|
|
178
|
+
for t, loss_value in loss.items():
|
|
179
|
+
n = f"{stage}_{t}_loss" if "loss" not in t else f"{stage}_{t}"
|
|
180
|
+
self.log(n, loss_value, **kwargs)
|
|
181
|
+
|
|
182
|
+
def training_step(self, batch):
|
|
183
|
+
# foward pass
|
|
184
|
+
preds, labels, pad_masks, loss = self.shared_step(batch)
|
|
185
|
+
|
|
186
|
+
if loss["loss"].isnan():
|
|
187
|
+
raise RuntimeError(
|
|
188
|
+
"Loss is NaN - this indicates something significant has gone wrong."
|
|
189
|
+
"Check for any NaNs or infs in the input dataset. If nothing is found here, "
|
|
190
|
+
"check 'docs/training.md - NaNs' for more information"
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# log losses
|
|
194
|
+
self.log_losses(loss, stage="train")
|
|
195
|
+
|
|
196
|
+
outputs = {
|
|
197
|
+
"preds": preds,
|
|
198
|
+
"labels": labels,
|
|
199
|
+
"pad_masks": pad_masks,
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return {**loss, "outputs": outputs}
|
|
203
|
+
|
|
204
|
+
def validation_step(self, batch):
|
|
205
|
+
# foward pass
|
|
206
|
+
preds, labels, pad_masks, loss = self.shared_step(batch)
|
|
207
|
+
|
|
208
|
+
# log losses
|
|
209
|
+
self.log_losses(loss, stage="val")
|
|
210
|
+
|
|
211
|
+
# Store outputs to be used by the MaskformerMetrics callback
|
|
212
|
+
outputs = {
|
|
213
|
+
"preds": preds,
|
|
214
|
+
"labels": labels,
|
|
215
|
+
"pad_masks": pad_masks,
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return {**loss, "outputs": outputs}
|
|
219
|
+
|
|
220
|
+
def test_step(self, batch):
|
|
221
|
+
inputs, pad_masks, _ = batch
|
|
222
|
+
batch = (inputs, pad_masks, None)
|
|
223
|
+
return self.shared_step(batch, evaluation=True)[0]
|
|
224
|
+
|
|
225
|
+
def configure_optimizers(self):
|
|
226
|
+
if self.muP:
|
|
227
|
+
from mup import MuAdamW as AdamW
|
|
228
|
+
else:
|
|
229
|
+
from torch.optim import AdamW
|
|
230
|
+
opt = AdamW(
|
|
231
|
+
self.parameters(),
|
|
232
|
+
lr=self.lrs_config["initial"],
|
|
233
|
+
weight_decay=self.lrs_config.get("weight_decay", 1e-5),
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
# 1cycle
|
|
237
|
+
sch = torch.optim.lr_scheduler.OneCycleLR(
|
|
238
|
+
opt,
|
|
239
|
+
max_lr=self.lrs_config["max"],
|
|
240
|
+
total_steps=self.trainer.estimated_stepping_batches,
|
|
241
|
+
div_factor=self.lrs_config["max"] / self.lrs_config["initial"],
|
|
242
|
+
final_div_factor=self.lrs_config["initial"] / self.lrs_config["end"],
|
|
243
|
+
pct_start=float(self.lrs_config["pct_start"]),
|
|
244
|
+
last_epoch=int(self.lrs_config.get("last_epoch", -1)),
|
|
245
|
+
)
|
|
246
|
+
sch = {"scheduler": sch, "interval": "step"}
|
|
247
|
+
|
|
248
|
+
return [opt], [sch]
|
|
249
|
+
|
|
250
|
+
@property
|
|
251
|
+
def input_dims(self) -> dict[str, int]:
|
|
252
|
+
return {k: len(v) for k, v in self.norm.variables.items()}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: salt-ml
|
|
3
|
+
Version: 0.6
|
|
4
|
+
Summary: Multimodal and Multiclass Machine Learning for High Energy Physics
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt
|
|
7
|
+
Project-URL: Issue Tracker, https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/salt/-/issues
|
|
8
|
+
Requires-Python: <3.12,>=3.10
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pytest==7.4.2
|
|
11
|
+
Requires-Dist: pytest-cov==4.1.0
|
|
12
|
+
Requires-Dist: comet_ml==3.35.3
|
|
13
|
+
Requires-Dist: tqdm==4.66.1
|
|
14
|
+
Requires-Dist: rich==13.6.0
|
|
15
|
+
Requires-Dist: pre-commit==3.5.0
|
|
16
|
+
Requires-Dist: ruff==0.2.2
|
|
17
|
+
Requires-Dist: h5py==3.10.0
|
|
18
|
+
Requires-Dist: numpy==1.24.2
|
|
19
|
+
Requires-Dist: torch==2.2.1
|
|
20
|
+
Requires-Dist: lightning==2.2.0
|
|
21
|
+
Requires-Dist: jsonargparse[all]==4.32.0
|
|
22
|
+
Requires-Dist: torchmetrics==1.2.1
|
|
23
|
+
Requires-Dist: onnx==1.16.0
|
|
24
|
+
Requires-Dist: onnxruntime==1.15.1
|
|
25
|
+
Requires-Dist: atlas-ftag-tools==0.2.2
|
|
26
|
+
Requires-Dist: scipy==1.12.0
|
|
27
|
+
Requires-Dist: mup==1.0.0
|
|
28
|
+
Requires-Dist: boto3==1.28.17
|
|
29
|
+
Requires-Dist: s3fs==2023.9.2
|
|
30
|
+
Requires-Dist: s3path==0.5.0
|
|
31
|
+
Requires-Dist: tensorboard==2.14.1
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
requirements.txt
|
|
5
|
+
salt/__init__.py
|
|
6
|
+
salt/main.py
|
|
7
|
+
salt/modelwrapper.py
|
|
8
|
+
salt/stypes.py
|
|
9
|
+
salt_ml.egg-info/PKG-INFO
|
|
10
|
+
salt_ml.egg-info/SOURCES.txt
|
|
11
|
+
salt_ml.egg-info/dependency_links.txt
|
|
12
|
+
salt_ml.egg-info/entry_points.txt
|
|
13
|
+
salt_ml.egg-info/requires.txt
|
|
14
|
+
salt_ml.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
compare_models = salt.utils.compare_models:main
|
|
3
|
+
download_S3 = salt.utils.file_utils:download_from_S3
|
|
4
|
+
get_onnx_metadata = salt.utils.get_onnx_metadata:main
|
|
5
|
+
repair_ckpt = salt.utils.repair_ckpt:main
|
|
6
|
+
salt = salt.main:main
|
|
7
|
+
setup_muP = salt.utils.muP_utils.main_muP:main
|
|
8
|
+
to_onnx = salt.onnx.to_onnx:main
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pytest==7.4.2
|
|
2
|
+
pytest-cov==4.1.0
|
|
3
|
+
comet_ml==3.35.3
|
|
4
|
+
tqdm==4.66.1
|
|
5
|
+
rich==13.6.0
|
|
6
|
+
pre-commit==3.5.0
|
|
7
|
+
ruff==0.2.2
|
|
8
|
+
h5py==3.10.0
|
|
9
|
+
numpy==1.24.2
|
|
10
|
+
torch==2.2.1
|
|
11
|
+
lightning==2.2.0
|
|
12
|
+
jsonargparse[all]==4.32.0
|
|
13
|
+
torchmetrics==1.2.1
|
|
14
|
+
onnx==1.16.0
|
|
15
|
+
onnxruntime==1.15.1
|
|
16
|
+
atlas-ftag-tools==0.2.2
|
|
17
|
+
scipy==1.12.0
|
|
18
|
+
mup==1.0.0
|
|
19
|
+
boto3==1.28.17
|
|
20
|
+
s3fs==2023.9.2
|
|
21
|
+
s3path==0.5.0
|
|
22
|
+
tensorboard==2.14.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
salt
|
salt_ml-0.6/setup.cfg
ADDED