Skip to content

Commit

Permalink
moving reference_submissions/ to tests/reference_algorithms/
Browse files Browse the repository at this point in the history
  • Loading branch information
znado committed Oct 11, 2022
1 parent f714190 commit b2f6a0e
Show file tree
Hide file tree
Showing 63 changed files with 23 additions and 23 deletions.
1 change: 0 additions & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
pylint algorithmic_efficiency
pylint baselines
pylint target_setting_runs
pylint reference_submissions
pylint submission_runner.py
pylint tests
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ python3 submission_runner.py \
--framework=jax \
--workload=mnist \
--experiment_dir=/home/znado \
--submission_path=reference_submissions/mnist/mnist_jax/submission.py \
--tuning_search_space=reference_submissions/mnist/tuning_search_space.json
--submission_path=tests/reference_algorithms/mnist/mnist_jax/submission.py \
--tuning_search_space=tests/reference_algorithms/mnist/tuning_search_space.json
```

### PyTorch
Expand All @@ -164,8 +164,8 @@ python3 submission_runner.py \
--framework=pytorch \
--workload=mnist \
--experiment_dir=/home/znado \
--submission_path=reference_submissions/mnist/mnist_pytorch/submission.py \
--tuning_search_space=reference_submissions/mnist/tuning_search_space.json
--submission_path=tests/reference_algorithms/mnist/mnist_pytorch/submission.py \
--tuning_search_space=tests/reference_algorithms/mnist/tuning_search_space.json
```

When using multiple GPUs on a single node it is recommended to use PyTorch's
Expand Down Expand Up @@ -197,7 +197,7 @@ To run the below commands, use the versions installed via `pip install -e '.[dev

To automatically fix formatting errors, run the following (*WARNING:* this will edit your code, so it is suggested to make a git commit first!):
```bash
yapf -i -r -vv -p algorithmic_efficiency baselines target_setting_runs reference_submissions tests *.py
yapf -i -r -vv -p algorithmic_efficiency baselines target_setting_runs tests/reference_algorithms tests *.py
```

To sort all import orderings, run the following:
Expand All @@ -215,9 +215,9 @@ To print out all offending pylint issues, run the following:
pylint algorithmic_efficiency
pylint baselines
pylint target_setting_runs
pylint reference_submissions
pylint tests/reference_algorithms
pylint submission_runner.py
pylint tests
```

You can also use `python tests/reference_submission_tests.py` to run a single model update and two model evals for each workload using the reference algorithm in `reference_submissions/`.
You can also use `python tests/reference_submission_tests.py` to run a single model update and two model evals for each workload using the reference algorithm in `tests/reference_algorithms/`.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ this command will generate `spm_model.vocab` file in the folder it's run

> mkdir work_dir
> cd work_dir
> python3 ../prepare_data.py --data_dir=../data_dir/LibriSpeech --tokenizer_vocab_path=../spm_model.vocab
> python3 ../prepare_data.py --data_dir=../data_dir/LibriSpeech --tokenizer_vocab_path=../spm_model.vocab
the preprocessing script will generate `.npy` files for audio data, `features.csv` which have path to saved audio `.npy`
and `trans.csv` which has path to features.csv and transcription data, individual data loaders
and `trans.csv` which has path to features.csv and transcription data, individual data loaders

## Run workload
## Run workload

> cd algorithmic_efficiency
> python3 submission_runner.py --framework=jax --workload=librispeech_conformer --submission_path=reference_submissions/librispeech_conformer/librispeech_jax/submission.py --tuning_search_space=reference_submissions/librispeech_conformer/tuning_search_space.json --data_dir=algorithmic_efficiency/workloads/librispeech_conformer/work_dir/data --num_tuning_trials=1 --summary_log_dir=reference_submissions/librispeech_conformer/librispeech_jax/data_512_4_256_full_train_set/ --tokenizer_vocab_path=/home/smedapati_google_com/algorithmic-efficiency/algorithmic_efficiency/workloads/librispeech_conformer/spm_model.vocab
> python3 submission_runner.py --framework=jax --workload=librispeech_conformer --submission_path=tests/reference_algorithms/librispeech_conformer/librispeech_jax/submission.py --tuning_search_space=tests/reference_algorithms/librispeech_conformer/tuning_search_space.json --data_dir=algorithmic_efficiency/workloads/librispeech_conformer/work_dir/data --num_tuning_trials=1 --summary_log_dir=tests/reference_algorithms/librispeech_conformer/librispeech_jax/data_512_4_256_full_train_set/ --tokenizer_vocab_path=/home/smedapati_google_com/algorithmic-efficiency/algorithmic_efficiency/workloads/librispeech_conformer/spm_model.vocab
4 changes: 2 additions & 2 deletions submission_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
python3 submission_runner.py \
--workload=mnist \
--framework=jax \
--submission_path=reference_submissions/mnist/mnist_jax/submission.py \
--submission_path=tests/reference_algorithms/mnist/mnist_jax/submission.py \
--tuning_ruleset=external \
--tuning_search_space=reference_submissions/mnist/tuning_search_space.json \
--tuning_search_space=tests/reference_algorithms/mnist/tuning_search_space.json \
--num_tuning_trials=3 \
--experiment_dir=/home/username/codes/algorithmic-efficiency/experiment_dir
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/reference_submission_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Assumes that each reference submission is using the external tuning ruleset and
that it is defined in:
"reference_submissions/{workload}/{workload}_{framework}/submission.py"
"reference_submissions/{workload}/tuning_search_space.json".
"tests/reference_algorithms/{workload}/{workload}_{framework}/submission.py"
"tests/reference_algorithms/{workload}/tuning_search_space.json".
"""
import copy
import functools
Expand Down Expand Up @@ -362,9 +362,9 @@ def _make_paths(repo_location, framework, workload_name):
dataset_name = workload_name.split('_')[0]
else:
dataset_name = workload_name
workload_dir = f'{repo_location}/reference_submissions/{workload_name}'
workload_dir = f'{repo_location}/tests/reference_algorithms/{workload_name}'
search_space_path = f'{workload_dir}/tuning_search_space.json'
submission_path = (f'reference_submissions/{workload_name}/'
submission_path = (f'tests/reference_algorithms/{workload_name}/'
f'{dataset_name}_{framework}/submission.py')
full_submission_path = f'{repo_location}/{submission_path}'
if not os.path.exists(full_submission_path):
Expand All @@ -388,7 +388,7 @@ def test_submission(self):
# Example: /home/znado/algorithmic-efficiency
repo_location = '/'.join(self_location.split('/')[:-1])
if FLAGS.all:
references_dir = f'{repo_location}/reference_submissions'
references_dir = f'{repo_location}/tests/reference_algorithms'
for workload_name in os.listdir(references_dir):
for framework in ['jax', 'pytorch']:
if framework == 'pytorch':
Expand Down
9 changes: 5 additions & 4 deletions tests/submission_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ class SubmissionRunnerTest(parameterized.TestCase):
testcase_name='mnist_jax',
workload='mnist',
framework='jax',
submission_path='reference_submissions/mnist/mnist_jax/submission.py',
submission_path=(
'tests/reference_algorithms/mnist/mnist_jax/submission.py'),
tuning_search_space=(
'reference_submissions/mnist/tuning_search_space.json')),
'tests/reference_algorithms/mnist/tuning_search_space.json')),
dict(
testcase_name='mnist_pytorch',
workload='mnist',
framework='pytorch',
submission_path=(
'reference_submissions/mnist/mnist_pytorch/submission.py'),
'tests/reference_algorithms/mnist/mnist_pytorch/submission.py'),
tuning_search_space=(
'reference_submissions/mnist/tuning_search_space.json')),
'tests/reference_algorithms/mnist/tuning_search_space.json')),
)
def test_submission(self,
workload,
Expand Down

0 comments on commit b2f6a0e

Please sign in to comment.