Repository navigation
Expand file tree
/
Copy pathdebug.py
More file actions
97 lines (80 loc) · 3.69 KB
/
Copy pathdebug.py
File metadata and controls
97 lines (80 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# SPDX-License-Identifier: GPL-3.0-or-later
#
# XANESNET
#
# Authors: Hendrik Junkawitsch, Tom J. Penfold, Thomas J. Pope, C. D. Rankine, B. Li
#
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
# Citations:
# Junkawitsch et al., "XANESNET: A Modular, Extensible, and Flexible Machine Learning Framework for Spectroscopy."
# Rankine et al., "A Deep Neural Network for the Rapid Prediction of X-ray Absorption Spectra."
# Rankine et al., "Accurate, affordable, and generalizable machine learning simulations of transition metal x-ray absorption spectra using the XANESNET deep neural network."
# Penfold et al., "Field-Aware Energy-Conditioned Message Passing Neural Networks for Absorber-Centred Modelling of X-ray Spectroscopy."
# Penfold et al., "A deep neural network for valence-to-core X-ray emission spectroscopy."
# Falbo et al., "On the Analysis of X-ray Absorption Spectra for Polyoxometallates."
# Madkhali et al., "Enhancing the Analysis of Disorder in X-ray Absorption Spectra: Application of Deep Neural Networks to T-Jump X-ray Probe Experiments."
# Madkhali et al., "The Role of Structural Representation in the Performance of a Deep Neural Network for X-ray Spectroscopy."
"""Debug entry points for development purposes."""
from xanesnet.cli import main
def run_debug_train() -> None:
"""Run the configured debug training command through the CLI."""
debug_args = [
"train",
"-i",
"./configs/<...>.yaml", # Insert path to training config
"-n",
"<...>", # Insert name for training run
# "--tensorboard", # Enable TensorBoard logging
"--yes", # Skip all prompts with yes (use with caution!)
# "--dry-run", # Run one real training epoch and save model_profile.json
]
print("Running in debug mode with the following arguments:")
print(debug_args)
main(debug_args)
def run_debug_infer() -> None:
"""Run the configured debug inference command through the CLI."""
debug_args = [
"infer",
"-i",
"./configs/<...>.yaml", # Insert path to inference config
"-m",
"./runs/<...>/models/final.pth", # Insert path to trained model (final.pth)
"-n",
"<...>", # Insert name for inference run
"--yes", # Skip all prompts with yes (use with caution!)
]
print("Running in debug mode with the following arguments:")
print(debug_args)
main(debug_args)
def run_debug_analyze() -> None:
"""Run the configured debug analysis command through the CLI."""
debug_args = [
"analyze",
"-i",
"./configs/<...>.yaml", # Insert path to analysis config
"-r",
"./runs/<...>/", # Insert path to inference directory
"-r",
"./runs/<...>/",
"-n",
"<...>", # Insert name for analysis run
"--yes", # Skip all prompts with yes (use with caution!)
]
print("Running in debug mode with the following arguments:")
print(debug_args)
main(debug_args)
if __name__ == "__main__":
# Uncomment the desired debug function to run it.
run_debug_train()
# run_debug_infer()
# run_debug_analyze()