-
Notifications
You must be signed in to change notification settings - Fork 37
Make solver resume work and keep the training history #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marisbasha
wants to merge
2
commits into
TuragaLab:main
Choose a base branch
from
marisbasha:fix/solver-resume
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+224
−21
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| from importlib import resources | ||
|
|
||
| from flyvis.network.directories import NetworkDir | ||
|
|
||
| TRAIN_SINGLE = str(resources.files("flyvis_cli") / "training" / "train_single.py") | ||
|
|
||
|
|
||
| def train_single(root_dir, sintel_path, *overrides): | ||
| return subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| TRAIN_SINGLE, | ||
| "task_name=flow", | ||
| "ensemble_and_network_id=0000/000", | ||
| "description=test", | ||
| "task.n_iters=4", | ||
| f"+task.dataset.sintel_path={sintel_path}", | ||
| "task.original_split=false", | ||
| "task.dataset.boxfilter.extent=1", | ||
| "task.dataset.n_frames=4", | ||
| "task.dataset.dt=0.041", | ||
| "task.batch_size=2", | ||
| "network.connectome.extent=1", | ||
| "scheduler.chkpt_every_epoch=1", | ||
| *overrides, | ||
| ], | ||
| cwd=root_dir, | ||
| env={**os.environ, "FLYVIS_ROOT_DIR": str(root_dir)}, | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
|
|
||
|
|
||
| def test_train_single_resume(mock_sintel_data, tmp_path): | ||
| # only the initial checkpoint, as left by a job stopped before training | ||
| run = train_single(tmp_path, mock_sintel_data, "train=false", "checkpoint_only=true") | ||
| assert run.returncode == 0, run.stderr | ||
|
|
||
| # the same command again would train over the existing checkpoints | ||
| run = train_single(tmp_path, mock_sintel_data) | ||
| assert run.returncode != 0 | ||
| assert "already has checkpoints" in run.stderr | ||
|
|
||
| run = train_single(tmp_path, mock_sintel_data, "resume=true") | ||
| assert run.returncode == 0, run.stderr | ||
|
|
||
| network_dir = NetworkDir(tmp_path / "results" / "flow" / "0000" / "000") | ||
| assert len(network_dir.loss[:]) == 4 | ||
| assert network_dir.chkpt_iter[:].tolist()[-1] == 3 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.