Skip to content

Commit 4bf6ec5

Browse files
committed
Formatting
1 parent ca325bc commit 4bf6ec5

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ We recommend using distinct output directories for every training run.
6464
Regarding other optional arguments, run `python scripts/transferable.py -h` for more information.
6565

6666
**Note**: Checkpoints are stored using `pickle`. This means that opening a checkpoint from an untrusted source is a major security risk. Only ever open checkpoint files from trusted sources. To prevent reading untrusted pickle files, checkpoint reading is disabled by default and can be
67-
re-enabled by settings the environment variables `ORBFORMER_PICKLE_LOADING=1`.
67+
re-enabled by settings the environment variable `ORBFORMER_PICKLE_LOADING=1`.
6868

6969
### Preparing new structure data for fine-tuning
7070

src/oneqmc/entrypoint.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
def load_chkpt_file(chkpt: str, discard_sampler_state: bool) -> Tuple[TrainState, int]:
2121
if not os.environ["ORBFORMER_PICKLE_LOADING"] == "1":
22-
raise PermissionError("Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow")
22+
raise PermissionError(
23+
"Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow"
24+
)
2325
with open(chkpt, "rb") as chkpt_file:
2426
init_step, (smpl_state, param_state, opt_state) = pickle.load(chkpt_file)
2527
if discard_sampler_state:
@@ -31,7 +33,9 @@ def load_chkpt_file(chkpt: str, discard_sampler_state: bool) -> Tuple[TrainState
3133

3234
def load_density_chkpt_file(chkpt: str, discard_sampler_state: bool) -> Tuple[Tuple, int]:
3335
if not os.environ["ORBFORMER_PICKLE_LOADING"] == "1":
34-
raise PermissionError("Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow")
36+
raise PermissionError(
37+
"Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow"
38+
)
3539
with open(chkpt, "rb") as chkpt_file:
3640
init_step, (param_state, opt_state) = pickle.load(chkpt_file)
3741
return (param_state, opt_state), init_step

src/oneqmc/log.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ def last(self):
134134
step_fast, step_slow = -1, -1 # account for the case where a queue is not initialized
135135
while self.fast_chkpts:
136136
if not os.environ["ORBFORMER_PICKLE_LOADING"] == "1":
137-
raise PermissionError("Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow")
137+
raise PermissionError(
138+
"Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow"
139+
)
138140
with self.fast_chkpts.pop(-1).path.open("rb") as f:
139141
step_fast, last_chkpt_fast = pickle.load(f)
140142
if not jax.tree.reduce(
@@ -145,7 +147,9 @@ def last(self):
145147
break
146148
while self.slow_chkpts:
147149
if not os.environ["ORBFORMER_PICKLE_LOADING"] == "1":
148-
raise PermissionError("Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow")
150+
raise PermissionError(
151+
"Loading pickle files is disable for security. Set ORBFORMER_PICKLE_LOADING=1 to allow"
152+
)
149153
with self.slow_chkpts.pop(-1).path.open("rb") as f:
150154
step_slow, last_chkpt_slow = pickle.load(f)
151155
if not jax.tree.reduce(

tests/integration_tests/test_scripts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def runner(extra_args):
5252
],
5353
cwd=project_root,
5454
capture_output=True,
55-
env={"ORBFORMER_PICKLE_LOADING": "1"}
55+
env={"ORBFORMER_PICKLE_LOADING": "1"},
5656
)
5757
if result.returncode != 0:
5858
raise OneQMCProcessError(result.stderr.decode())
@@ -91,7 +91,7 @@ def runner(extra_args):
9191
],
9292
cwd=project_root,
9393
capture_output=True,
94-
env={"ORBFORMER_PICKLE_LOADING": "1"}
94+
env={"ORBFORMER_PICKLE_LOADING": "1"},
9595
)
9696
if result.returncode != 0:
9797
raise OneQMCProcessError(result.stderr.decode())

0 commit comments

Comments
 (0)