-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't run evaluate tasks on pretrained models (#781)
This is accomplished with a new transform used by the `evaluate` tasks, which avoids yielding any tasks whose `stage` matches a `pretrained-models` stage.
- Loading branch information
Showing
5 changed files
with
99 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from copy import deepcopy | ||
|
||
from taskgraph.taskgraph import TaskGraph | ||
|
||
from translations_taskgraph.parameters import get_defaults | ||
|
||
PARAMS = deepcopy(get_defaults(None)) | ||
PARAMS["target_tasks_method"] = "train-target-tasks" | ||
PARAMS["training_config"]["experiment"]["pretrained-models"] = { | ||
"train-teacher": { | ||
"mode": "use", | ||
"type": "default", | ||
"urls": [ | ||
"https://storage.googleapis.com/releng-translations-dev/models/ru-en/better-teacher/student" | ||
], | ||
}, | ||
} | ||
|
||
MOCK_REQUESTS = [ | ||
{ | ||
"method": "POST", | ||
"url": "https://firefox-ci-tc.services.mozilla.com/api/index/v1/tasks/indexes", | ||
"responses": [{"json": {"tasks": []}}], | ||
}, | ||
{ | ||
"method": "POST", | ||
"url": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/tasks/status", | ||
"responses": [{"json": {"statuses": []}}], | ||
}, | ||
] | ||
|
||
|
||
def test_artifact_mounts(full_task_graph: TaskGraph): | ||
task = [t for t in full_task_graph.tasks.values() if t.label == "train-teacher-ru-en-1"][0] | ||
# No need to bother looking for _all_ files (we'd just duplicate | ||
# the full list if we did that...), but we verify that one file | ||
# is well formed. | ||
mounted_files = {m["file"]: m for m in task.task["payload"]["mounts"] if "file" in m} | ||
assert mounted_files["./artifacts/model.npz"]["content"] == { | ||
"url": "https://storage.googleapis.com/releng-translations-dev/models/ru-en/better-teacher/student/model.npz", | ||
} | ||
|
||
|
||
def test_no_eval_tasks(optimized_task_graph: TaskGraph): | ||
"""Ensure evaluate tasks for train-teacher aren't targeted. | ||
See https://github.com/mozilla/firefox-translations-training/issues/628""" | ||
eval_tasks = [ | ||
task.label | ||
for task in optimized_task_graph.tasks.values() | ||
if task.label.startswith("evaluate-teacher") | ||
] | ||
assert len(eval_tasks) == 0 |
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