-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from valentingol/dev
🆙 Upgrade to 0.2.2
- Loading branch information
Showing
15 changed files
with
210 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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,17 @@ | ||
"""Test /utils/train/random_utils.py.""" | ||
|
||
import random | ||
|
||
import numpy as np | ||
import torch | ||
|
||
from utils.train.random_utils import set_global_seed | ||
|
||
|
||
def test_set_global_seed() -> None: | ||
"""Test set_global_seed.""" | ||
set_global_seed(0) | ||
# Test the expected values for this particular seed. | ||
assert torch.randint(1000, size=(1,)) == 44 | ||
assert np.random.randint(0, 1000) == 684 | ||
assert random.randint(0, 1000) == 864 |
This file contains 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,15 @@ | ||
"""Test /utils/train/time_utils.py.""" | ||
|
||
import time | ||
|
||
from utils.train.time_utils import get_delta_eta | ||
|
||
|
||
def test_get_delta_eta() -> None: | ||
"""Test get_delta_eta.""" | ||
params = {'start_step': 1000, 'step': 2000, 'total_step': 3000} | ||
start_time = time.time() - 90 # simulate 1 minute 30 seconds elapsed | ||
delta_str, eta_str = get_delta_eta(start_time=start_time, **params) | ||
# NOTE: add margin of error to taking into account the call time | ||
assert delta_str in [f'00h01m{i}s' for i in range(25, 35)] | ||
assert eta_str in [f'00h01m{i}s' for i in range(25, 35)] |
This file contains 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
Oops, something went wrong.