Skip to content

Commit

Permalink
refactor: Prepare performance aware triggers (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinholzi authored Aug 19, 2024
1 parent 3da3b5c commit 5d1b088
Show file tree
Hide file tree
Showing 69 changed files with 602 additions and 405 deletions.
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp0_finetune.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp10_triggerbalanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp1_random_ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp2_dlis_gradnorm_bts_ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp3_dlis_loss_bts_ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp4_triggerbalanced_tail3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp5_current_trigger_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp6_retrain_keep_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp7_retrain_new_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp8_dlis_gradnorm_bts_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/cloc/pipelines/exp9_random_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ trigger:
trigger_every: "52w"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: cloc
transformations:
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp0_finetune.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp10_triggerbalanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp1_random_ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp3_dlis_loss_bts_ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp5_current_day_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp6_retrain_keep_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp7_retrain_new_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/criteo_1TB/pipelines/exp9_random_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ trigger:
trigger_every: "1d"
evaluation:
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: criteo
bytes_parser_function: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/sigmod/selection/arxiv_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def gen_arxiv_config(
after_pipeline_evaluation_workers=2,
after_training_evaluation_workers=2,
device=gpu_device,
result_writers=["json"],
datasets=[
EvalDataConfig(
dataset_id=dataset,
Expand Down
1 change: 0 additions & 1 deletion benchmark/sigmod/selection/cglm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def gen_cglm_config(
after_pipeline_evaluation_workers=4,
after_training_evaluation_workers=4,
device=gpu_device,
result_writers=["json"],
datasets=[
EvalDataConfig(
dataset_id=_dataset,
Expand Down
1 change: 0 additions & 1 deletion benchmark/sigmod/selection/yearbook_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def gen_yearbook_config(
after_pipeline_evaluation_workers=12,
after_training_evaluation_workers=12,
device=gpu_device,
result_writers=["json"],
datasets=[
EvalDataConfig(
dataset_id=dataset,
Expand Down
1 change: 0 additions & 1 deletion benchmark/sigmod/triggering/yearbook_triggering_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def gen_yearbook_triggering_config(
after_pipeline_evaluation_workers=12,
after_training_evaluation_workers=12,
device=gpu_device,
result_writers=["json"],
datasets=[
EvalDataConfig(
dataset_id=dataset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ evaluation:
models: matrix
datasets: ["arxiv_test"]
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: arxiv_test
bytes_parser_function: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ evaluation:
models: matrix
datasets: ["huffpost_test"]
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: huffpost_test
bytes_parser_function: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ evaluation:
models: matrix
datasets: ["yearbook_test"]
device: "cuda:0"
result_writers: ["json"]
datasets:
- dataset_id: yearbook_test
bytes_parser_function: |
Expand Down
2 changes: 1 addition & 1 deletion docs/pipeline/TRIGGERING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classDiagram
<<Abstract>>
+init_trigger()
+inform()
+inform_previous_model()
+inform_new_model()
}
namespace simple_triggers {
Expand Down
4 changes: 2 additions & 2 deletions docs/pipeline/triggering/DRIFT_TRIGGERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classDiagram
<<abstract>>
+void init_trigger(TriggerContext context)
+Generator[Triggers] inform(new_data)
+void inform_previous_model(int previous_model_id)
+void inform_new_model(int previous_model_id)
}
class TimeTrigger {
Expand All @@ -41,7 +41,7 @@ classDiagram
+void init_trigger(TriggerContext context)
+Generator[triggers] inform(new_data)
+void inform_previous_model(int previous_model_id)
+void inform_new_model(int previous_model_id)
}
class DriftDecisionPolicy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def gen_pipeline_config(
evaluation=EvaluationConfig(
handlers=eval_handlers,
device="cuda:0",
result_writers=["json"],
datasets=[
EvalDataConfig(
dataset_id=yb_dataset_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def gen_pipeline_config(
evaluation=EvaluationConfig(
handlers=eval_handlers,
device="cuda:0",
result_writers=["json"],
after_training_evaluation_workers=10,
after_pipeline_evaluation_workers=10,
datasets=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def gen_pipeline_config(
evaluation=EvaluationConfig(
handlers=eval_handlers,
device=device,
result_writers=["json"],
after_pipeline_evaluation_workers=20,
after_training_evaluation_workers=20,
datasets=[
Expand Down
1 change: 0 additions & 1 deletion modyn/config/examples/example-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ evaluation:
models: matrix
datasets: ["mnist"]
device: "cpu"
result_writers: ["json", "tensorboard"]
datasets:
- dataset_id: mnist
transformations:
Expand Down
8 changes: 0 additions & 8 deletions modyn/config/schema/pipeline/evaluation/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ class EvaluationConfig(ModynBaseModel):
min_length=1,
)
device: str = Field(description="The device the model should be put on.")
result_writers: list[ResultWriterType] = Field(
["json"],
description=(
"List of names that specify in which formats to store the evaluation results. We currently support "
"json and tensorboard."
),
min_length=1,
)
datasets: list[EvalDataConfig] = Field(
description="An array of all datasets on which the model is evaluated.",
min_length=1,
Expand Down
11 changes: 10 additions & 1 deletion modyn/config/schema/pipeline/trigger/simple/time.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import cached_property
from typing import Literal

from pydantic import Field
from pydantic import Field, field_validator

from modyn.config.schema.base_model import ModynBaseModel
from modyn.const.regex import REGEX_TIME_UNIT
Expand All @@ -27,3 +27,12 @@ def every_seconds(self) -> int:
unit = str(self.every)[-1:]
num = int(str(self.every)[:-1])
return num * SECONDS_PER_UNIT[unit]

@field_validator("every")
@classmethod
def validate_every(cls, value: str) -> str:
unit = str(value)[-1:]
num = int(str(value)[:-1])
assert num * SECONDS_PER_UNIT[unit] >= 1, "trigger_every must be > 0, but is {self.config.every_seconds}"

return value
Loading

0 comments on commit 5d1b088

Please sign in to comment.