This commit is contained in:
Evgeny Pavlov 2024-10-22 13:11:36 -07:00 коммит произвёл GitHub
Родитель b0b5f25d02
Коммит 9956ef28e2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -32,10 +32,12 @@ CONTINUATION_ARTIFACTS = {
ARTIFACTS_URL = "{root_url}/api/queue/v1/task/{task_id}/runs/{run_id}/artifacts"
ARTIFACT_URL = "{root_url}/api/queue/v1/task/{task_id}/runs/{run_id}/artifacts/{artifact_name}"
# TODO: consolidate everything in train.py or at least do not rely on the argument names and the number of them in the Taskcluster part
# TODO: https://github.com/mozilla/firefox-translations-training/issues/607
# The argument number where pretrained model mode is expected.
# This is 1-indexed, not 0-indexed, so it should line up with the argument
# number this is fetched in in train-taskcluster.sh
PRETRAINED_MODEL_MODE_ARG_NUMBER = 12
PRETRAINED_MODEL_MODE_ARG_NUMBER = 13
# Nothing special about 17...just a number plucked out of thin air that
# should be distinct enough to retry on.
DOWNLOAD_ERROR_EXIT_CODE = 17

Просмотреть файл

@ -26,7 +26,7 @@ TRAIN_TASKCLUSTER_SH = os.path.normpath(
pytest.param(
[
"model_type",
"type",
"training_type",
"src",
"trg",
"train_set_prefix",
@ -35,14 +35,15 @@ TRAIN_TASKCLUSTER_SH = os.path.normpath(
"best_model_metric",
"alignments",
"seed",
"mode",
"teacher_mode",
"student_model",
],
id="required_only",
),
pytest.param(
[
"model_type",
"type",
"training_type",
"src",
"trg",
"train_set_prefix",
@ -51,7 +52,8 @@ TRAIN_TASKCLUSTER_SH = os.path.normpath(
"best_model_metric",
"alignments",
"seed",
"mode",
"teacher_mode",
"student_model",
"pretrained_model_mode",
"pretrained_model_type",
],
@ -60,7 +62,7 @@ TRAIN_TASKCLUSTER_SH = os.path.normpath(
pytest.param(
[
"model_type",
"type",
"training_type",
"src",
"trg",
"train_set_prefix",
@ -69,7 +71,8 @@ TRAIN_TASKCLUSTER_SH = os.path.normpath(
"best_model_metric",
"alignments",
"seed",
"mode",
"teacher_mode",
"student_model",
"pretrained_model_mode",
"pretrained_model_type",
"--foo",
@ -281,17 +284,18 @@ def test_autocontinue(
model_dir = DataDir("test_train_taskcluster").path
train_taskcluster.main(
[
"model-type",
"training-type",
"model_type",
"training_type",
"src",
"trg",
"train-set-prefix",
"valid-set-prefix",
model_dir,
"best-model-metric",
"alignents",
"alignments",
"seed",
"mode",
"teacher_mode",
"student_model",
orig_pretrained_model_mode,
]
)
@ -346,10 +350,10 @@ def test_autocontinue(
assert tt_mock["requests"].get.call_args_list == calls
assert tt_mock["subprocess"].run.call_count == 1
# pretrained model mode is the 12th arg to the training script, but subprocess
# pretrained model mode is the 13th arg to the training script, but subprocess
# is also given the script name - so we look for the expected pretrained model mode
# in the 13th arg of the subprocess.run call
assert (
tt_mock["subprocess"].run.call_args_list[0][0][0][12]
tt_mock["subprocess"].run.call_args_list[0][0][0][13]
== expected_pretrained_model_mode
)