GANDLF 0.1.3.dev20250217__py3-none-any.whl → 0.1.3.dev20250219__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.

Potentially problematic release.


This version of GANDLF might be problematic. Click here for more details.

GANDLF/cli/main_run.py CHANGED
@@ -19,6 +19,7 @@ def main_run(
19
19
  device: str,
20
20
  resume: bool,
21
21
  reset: bool,
22
+ _profile: Optional[bool] = False,
22
23
  output_dir: Optional[str] = None,
23
24
  ) -> None:
24
25
  """
@@ -98,6 +99,7 @@ def main_run(
98
99
  device=device,
99
100
  resume=resume,
100
101
  reset=reset,
102
+ _profile=_profile,
101
103
  )
102
104
  else:
103
105
  data_full, headers = parseTrainingCSV(file_data_full, train=train_mode)
GANDLF/entrypoints/run.py CHANGED
@@ -24,6 +24,7 @@ def _run(
24
24
  reset_flag: bool,
25
25
  resume_flag: bool,
26
26
  output_path: Optional[str],
27
+ _profile: Optional[bool] = False,
27
28
  ):
28
29
  if model_dir is None and output_path:
29
30
  model_dir = output_path
@@ -60,6 +61,7 @@ def _run(
60
61
  logging.debug(f"{reset_flag=}")
61
62
  logging.debug(f"{resume_flag=}")
62
63
  logging.debug(f"{output_path=}")
64
+ logging.debug(f"{_profile=}")
63
65
 
64
66
  main_run(
65
67
  data_csv=input_data,
@@ -70,6 +72,7 @@ def _run(
70
72
  resume=resume_flag,
71
73
  reset=reset_flag,
72
74
  output_dir=output_path,
75
+ _profile=_profile,
73
76
  )
74
77
  print("Finished.")
75
78
 
@@ -145,6 +148,12 @@ def _run(
145
148
  default=None,
146
149
  help="Output file which will contain the logs.",
147
150
  )
151
+ @click.option(
152
+ "--profile",
153
+ "-pf",
154
+ is_flag=True,
155
+ help="Track the run time and memory consumption for each layer",
156
+ )
148
157
  @append_copyright_to_help
149
158
  def new_way(
150
159
  config: str,
@@ -156,6 +165,7 @@ def new_way(
156
165
  resume: bool,
157
166
  output_path: str,
158
167
  raw_input: str,
168
+ profile: bool,
159
169
  log_file: str,
160
170
  ):
161
171
  """Semantic segmentation, regression, and classification for medical images using Deep Learning."""
@@ -170,6 +180,7 @@ def new_way(
170
180
  reset_flag=reset,
171
181
  resume_flag=resume,
172
182
  output_path=output_path,
183
+ _profile=profile,
173
184
  )
174
185
 
175
186
 
@@ -1,6 +1,7 @@
1
1
  import pandas as pd
2
2
  import os, pickle, shutil
3
3
  from pathlib import Path
4
+ from torch.profiler import profile, ProfilerActivity
4
5
 
5
6
  from GANDLF.compute import training_loop
6
7
  from GANDLF.utils import get_dataframe, split_data
@@ -145,6 +146,7 @@ def TrainingManager_split(
145
146
  device: str,
146
147
  resume: bool,
147
148
  reset: bool,
149
+ _profile: bool,
148
150
  ):
149
151
  """
150
152
  This is the training manager that ties all the training functionality together
@@ -158,6 +160,8 @@ def TrainingManager_split(
158
160
  device (str): The device to perform computations on.
159
161
  resume (bool): Whether the previous run will be resumed or not.
160
162
  reset (bool): Whether the previous run will be reset or not.
163
+ _profile(bool):Whether the we want the profile activity or not.
164
+
161
165
  """
162
166
  currentModelConfigPickle = os.path.join(outputDir, "parameters.pkl")
163
167
  currentModelConfigYaml = os.path.join(outputDir, "config.yaml")
@@ -178,11 +182,27 @@ def TrainingManager_split(
178
182
  with open(currentModelConfigYaml, "w") as handle:
179
183
  yaml.dump(parameters, handle, default_flow_style=False)
180
184
 
181
- training_loop(
182
- training_data=dataframe_train,
183
- validation_data=dataframe_validation,
184
- output_dir=outputDir,
185
- device=device,
186
- params=parameters,
187
- testing_data=dataframe_testing,
188
- )
185
+ if _profile:
186
+ with profile(
187
+ activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA],
188
+ profile_memory=True,
189
+ record_shapes=True,
190
+ ) as prof:
191
+ training_loop(
192
+ training_data=dataframe_train,
193
+ validation_data=dataframe_validation,
194
+ output_dir=outputDir,
195
+ device=device,
196
+ params=parameters,
197
+ testing_data=dataframe_testing,
198
+ )
199
+ print(prof.key_averages().table(sort_by="cpu_time_total", row_limit=10))
200
+ else:
201
+ training_loop(
202
+ training_data=dataframe_train,
203
+ validation_data=dataframe_validation,
204
+ output_dir=outputDir,
205
+ device=device,
206
+ params=parameters,
207
+ testing_data=dataframe_testing,
208
+ )
GANDLF/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.3-dev20250217"
1
+ __version__ = "0.1.3-dev20250219"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: GANDLF
3
- Version: 0.1.3.dev20250217
3
+ Version: 0.1.3.dev20250219
4
4
  Summary: PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging.
5
5
  Author: MLCommons
6
6
  Author-email: gandlf@mlcommons.org
@@ -4,8 +4,8 @@ GANDLF/inference_manager.py,sha256=ncT8HFo46IIpD_mw8i2mmOnMkhvPrWJITfiNQ1uBIco,4
4
4
  GANDLF/logger.py,sha256=oamQ1SOTTpAnC8vQ67o211Q6_bExGg_hAuqlHGlJfAI,2951
5
5
  GANDLF/logging_config.yaml,sha256=9XxRxAKtLn5ehT1khpR8wEiJGW64sx1lylAspM5KaWk,1337
6
6
  GANDLF/parseConfig.py,sha256=jO-ybIPxLw23OWDvFdTukbft0ZM8UOofGnoL2C5CEps,754
7
- GANDLF/training_manager.py,sha256=FXvQ4p3DELzR2MtfG1ANsOL1X9Oo99X8rm4npJ7xLlo,7302
8
- GANDLF/version.py,sha256=wYhOU5yEFXHDcFkcrP79NOpeCMjXY19aK4CZPDAaeXs,34
7
+ GANDLF/training_manager.py,sha256=t7zcOVdgu5AhOhY544joxfTNR00ixnXQfQ4GWLk2o6Y,8058
8
+ GANDLF/version.py,sha256=hWsD3CO6U-PDppam4lwKhmncOJ1h6Thk_sCTg11NTfQ,34
9
9
  GANDLF/anonymize/__init__.py,sha256=Nxig-jM-a-aKlK09PNi1zhNulEpLTyjnsY_oGQKdjhQ,1953
10
10
  GANDLF/anonymize/convert_to_nifti.py,sha256=MOfSDncFGJGb-EQP9sFGn0yuKpX010Ioi2KNwttaex8,1339
11
11
  GANDLF/cli/__init__.py,sha256=F05eyL2HKyWkHczRZuPE_Z2Yg685P9ARYxTwz6njGeQ,784
@@ -14,7 +14,7 @@ GANDLF/cli/data_split_saver.py,sha256=72ygy9s3INt2NFAfSW4j9dxxmuuvfzfBTF0Hwh0nYB
14
14
  GANDLF/cli/deploy.py,sha256=55mnId66_-KOWROwPj9OEePENWm58BYFBvn_kWOdil8,15153
15
15
  GANDLF/cli/generate_metrics.py,sha256=t9Ecr8Vva03JBX_Og70QRnvJtmSXQg1q8YxlyoC_9DY,18981
16
16
  GANDLF/cli/huggingface_hub_handler.py,sha256=vGQYwDiT3Y8yk_xLNkB8DgW1rYpEcwYp0TCdCO5oWTs,4631
17
- GANDLF/cli/main_run.py,sha256=e4QMKti7AEaKI4NU4dlO64weS7UgwVXCanbDHdV2oXk,4415
17
+ GANDLF/cli/main_run.py,sha256=Du14psJsqS2wUe8XkfmdlQQutlNO7RYqoK-VNOslA0I,4488
18
18
  GANDLF/cli/patch_extraction.py,sha256=30RpBfjpwE9GLRSSD7JRqwoHngESQL0eOt09n_5r18Q,3555
19
19
  GANDLF/cli/post_training_model_optimization.py,sha256=cuPqUGrFcTIfhT67lAxpnywt8t9yrlqyHUl6wjr18qo,2111
20
20
  GANDLF/cli/preprocess_and_save.py,sha256=pvOI5oaM-GLDF2TdK9F9j_KMyvypNh155Hut_AvZphg,8814
@@ -71,7 +71,7 @@ GANDLF/entrypoints/optimize_model.py,sha256=w3A1n2jvH5s2bp9m3E3rUX1wd1J4Tt_zfOD3
71
71
  GANDLF/entrypoints/patch_miner.py,sha256=StrdmbAiECPpsN1AoZo75Mc1y-UAmKFyNfFmJrnHOg4,3095
72
72
  GANDLF/entrypoints/preprocess.py,sha256=-2XbLmRkQossOpZCU0HvvWWuKbefq6OE_Bf2HeHoYNk,5571
73
73
  GANDLF/entrypoints/recover_config.py,sha256=3eyYbQJMPcgZz6NDZFpJadbgUdnMF6chudRKqmBaJ4E,3712
74
- GANDLF/entrypoints/run.py,sha256=ChOpM5Cx1R2WbFo5zW3q0BuFpNXhTa7EXMdHAzcFtSk,9294
74
+ GANDLF/entrypoints/run.py,sha256=6A3OQw7DEeuJ_tPYnz4QovnI2sem09taAsq82gPZ6b8,9570
75
75
  GANDLF/entrypoints/split_csv.py,sha256=TZMpYjzPXD8koOdB7kokJYStQcfMzQD0z_Nysxvuxwo,3662
76
76
  GANDLF/entrypoints/subcommands.py,sha256=LyYgN5bOAF5K6laGWChe_CBi02RmPhIS7nYpiojOC0w,1768
77
77
  GANDLF/entrypoints/verify_install.py,sha256=E204smRPuH7Fv4rBPkjVXmxMPB_Tzd2lTAdVxp2hNhY,1370
@@ -159,9 +159,9 @@ GANDLF/utils/modelio.py,sha256=tWeTwVTvQy5I5hydxNZz4N8xEU3lHMayMa9gx5-Vr7Q,8016
159
159
  GANDLF/utils/parameter_processing.py,sha256=DA7ZEsizWWLJZnCxBnDNh1NyA-bw5oirOvodiZZWbIk,5675
160
160
  GANDLF/utils/tensor.py,sha256=AOwNTQfw9mnsomGwOF2Q_rdDS1WANlIatB0hhZN0gSg,21504
161
161
  GANDLF/utils/write_parse.py,sha256=bTBNxIaIGgjusq1mlHA8hioKZ6XmEJWFhfZWAQz2a9I,9197
162
- GANDLF-0.1.3.dev20250217.dist-info/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
163
- GANDLF-0.1.3.dev20250217.dist-info/METADATA,sha256=fw4EmhX23h0XptxJLiYl2l4Vi5jld3KvHTdDAVEi9KA,9726
164
- GANDLF-0.1.3.dev20250217.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
165
- GANDLF-0.1.3.dev20250217.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
166
- GANDLF-0.1.3.dev20250217.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
167
- GANDLF-0.1.3.dev20250217.dist-info/RECORD,,
162
+ GANDLF-0.1.3.dev20250219.dist-info/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
163
+ GANDLF-0.1.3.dev20250219.dist-info/METADATA,sha256=Sqleri1tKJa6abRvtCEQvMZYR07nD3qPP0EGbvObO14,9726
164
+ GANDLF-0.1.3.dev20250219.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
165
+ GANDLF-0.1.3.dev20250219.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
166
+ GANDLF-0.1.3.dev20250219.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
167
+ GANDLF-0.1.3.dev20250219.dist-info/RECORD,,