From e4a47bfa949a41ab698c9acd96b63a120aa69e16 Mon Sep 17 00:00:00 2001 From: Miles Olson Date: Wed, 31 Jul 2024 15:54:50 -0400 Subject: [PATCH 1/2] Update ax_multiobjective_nas_tutorial.py to use TensorboardMetric (#2985) Ax's TensorboardCurveMetric is going away soon and is replaced by TensorboardMetric. --- .ci/docker/requirements.txt | 4 ++-- .../ax_multiobjective_nas_tutorial.py | 22 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.ci/docker/requirements.txt b/.ci/docker/requirements.txt index 183867b2fc..e44feb39e2 100644 --- a/.ci/docker/requirements.txt +++ b/.ci/docker/requirements.txt @@ -31,7 +31,7 @@ torchx # TODO: use stable 0.5 when released -e git+https://github.com/pytorch/rl.git#egg=torchrl -e git+https://github.com/pytorch/tensordict.git#egg=tensordict -ax-platform +ax-platform>==0.4.0 nbformat>==5.9.2 datasets transformers @@ -69,4 +69,4 @@ pygame==2.1.2 pycocotools semilearn==0.3.2 torchao==0.0.3 -segment_anything==1.0 +segment_anything==1.0 \ No newline at end of file diff --git a/intermediate_source/ax_multiobjective_nas_tutorial.py b/intermediate_source/ax_multiobjective_nas_tutorial.py index 79b096b9e6..0f1ae21a55 100644 --- a/intermediate_source/ax_multiobjective_nas_tutorial.py +++ b/intermediate_source/ax_multiobjective_nas_tutorial.py @@ -232,21 +232,21 @@ def trainer( # we get the logic to read and parse the TensorBoard logs for free. # -from ax.metrics.tensorboard import TensorboardCurveMetric +from ax.metrics.tensorboard import TensorboardMetric +from tensorboard.backend.event_processing import plugin_event_multiplexer as event_multiplexer - -class MyTensorboardMetric(TensorboardCurveMetric): +class MyTensorboardMetric(TensorboardMetric): # NOTE: We need to tell the new TensorBoard metric how to get the id / # file handle for the TensorBoard logs from a trial. In this case # our convention is to just save a separate file per trial in # the prespecified log dir. - @classmethod - def get_ids_from_trials(cls, trials): - return { - trial.index: Path(log_dir).joinpath(str(trial.index)).as_posix() - for trial in trials - } + def _get_event_multiplexer_for_trial(self, trial): + mul = event_multiplexer.EventMultiplexer(max_reload_threads=20) + mul.AddRunsFromDirectory(Path(log_dir).joinpath(str(trial.index)).as_posix(), None) + mul.Reload() + + return mul # This indicates whether the metric is queryable while the trial is # still running. We don't use this in the current tutorial, but Ax @@ -266,12 +266,12 @@ def is_available_while_running(cls): val_acc = MyTensorboardMetric( name="val_acc", - curve_name="val_acc", + tag="val_acc", lower_is_better=False, ) model_num_params = MyTensorboardMetric( name="num_params", - curve_name="num_params", + tag="num_params", lower_is_better=True, ) From f5c28ebc60789f842aee66cdd270c1cdd326b2b9 Mon Sep 17 00:00:00 2001 From: leslie-fang-intel Date: Thu, 1 Aug 2024 04:07:08 +0800 Subject: [PATCH 2/2] Update link of dynamo overview (#2987) Co-authored-by: Svetlana Karslioglu --- prototype_source/pt2e_quantizer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype_source/pt2e_quantizer.rst b/prototype_source/pt2e_quantizer.rst index df666b1f6a..be6d6949ed 100644 --- a/prototype_source/pt2e_quantizer.rst +++ b/prototype_source/pt2e_quantizer.rst @@ -8,7 +8,7 @@ Prerequisites: Required: -- `Torchdynamo concepts in PyTorch `__ +- `Torchdynamo concepts in PyTorch `__ - `Quantization concepts in PyTorch `__