This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
feature(Types): added Experiment type encompassing Pipelines, metrics, project_name, etc. #114
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2771a7c
feature(Types): added Experiment type encompassing Pipelines, metrics…
almostintuitive f32cc94
fix(Run): updated after Experiment type was added
almostintuitive 4bd9a48
feature(Experiments): created the relevant experiments
almostintuitive 85d48ff
fix(Dependencies): pyarrow needs to be 3.0 or above
almostintuitive 49277e0
fix(Models): preferred_loag_origin should be local
almostintuitive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ channels: | |
- huggingface | ||
dependencies: | ||
- python=3.9 | ||
- pyarrow>=3.0 | ||
- black | ||
- ipython | ||
- notebook | ||
|
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 |
---|---|---|
@@ -1,69 +1,54 @@ | ||
from typing import List | ||
from typing import List, Optional | ||
|
||
from blocks.pipeline import Pipeline | ||
from configs.constants import Const | ||
from library.evaluation import calibration_metrics, classification_metrics | ||
from library.examples.hate_speech import ( | ||
cross_dataset_run_configs, | ||
ensemble_pipeline_hf, | ||
huggingface_baseline, | ||
preprocess_config, | ||
tweeteval_hate_speech_run_configs, | ||
vader, | ||
) | ||
from library.examples.hate_speech import all_cross_dataset_experiments | ||
from plugins import WandbConfig, WandbPlugin | ||
from runner.runner import Runner | ||
from type import Evaluators, PreprocessConfig, RunConfig | ||
from type import Experiment | ||
|
||
|
||
def run( | ||
pipeline: Pipeline, | ||
preprocess_config: PreprocessConfig, | ||
project_id: str, | ||
run_configs: List[RunConfig], | ||
metrics: Evaluators, | ||
experiments: List[Experiment], | ||
save_remote: Optional[ | ||
bool | ||
] = None, # If set True all models will try uploading (if configured), if set False it overwrites uploading of any models (even if configured) | ||
remote_logging: Optional[ | ||
bool | ||
] = None, # Switches on and off all remote logging (eg.: wandb) | ||
) -> None: | ||
|
||
for config in run_configs: | ||
for experiment in experiments: | ||
logger_plugins = ( | ||
[ | ||
WandbPlugin( | ||
WandbConfig( | ||
project_id=project_id, | ||
run_name=config.run_name + "-" + pipeline.id, | ||
project_id=experiment.project_name, | ||
run_name=experiment.run_name + "-" + experiment.pipeline.id, | ||
train=True, | ||
), | ||
dict( | ||
run_config=config.get_configs(), | ||
preprocess_config=preprocess_config.get_configs(), | ||
pipeline_configs=pipeline.get_configs(), | ||
run_config=experiment.get_configs(), | ||
preprocess_config=experiment.preprocessing_config.get_configs(), | ||
pipeline_configs=experiment.pipeline.get_configs(), | ||
), | ||
) | ||
] | ||
if config.remote_logging | ||
if remote_logging | ||
else [] | ||
) | ||
runner = Runner( | ||
config, | ||
pipeline, | ||
data={Const.input_col: config.dataset[Const.input_col]}, | ||
labels=config.dataset[Const.label_col] | ||
if hasattr(config.dataset, Const.label_col) | ||
else None, | ||
evaluators=metrics, | ||
experiment, | ||
data={Const.input_col: experiment.dataset[Const.input_col]}, | ||
labels=experiment.dataset[Const.label_col], | ||
plugins=logger_plugins, | ||
) | ||
runner.run() | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
metrics = classification_metrics + calibration_metrics | ||
|
||
run( | ||
vader, | ||
preprocess_config, | ||
project_id="hate-speech-detection", | ||
run_configs=cross_dataset_run_configs, | ||
metrics=metrics, | ||
all_cross_dataset_experiments, | ||
save_remote=False, | ||
remote_logging=True, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like remote_logging was not used anywhere! did we have it wired up on latest
main
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in one place: in
run.py
!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, my mistake! I meant save_remote, not remote_logging!