From 4d995745a83b60084abcf2f255fd22b316c547a3 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Mon, 23 May 2022 17:21:41 -0700 Subject: [PATCH] Run keras tuner from a temp directory Otherwise the temporary saved models will always be in your current working directory. I don't think we need to make this configurable, as you can already specify the output directory for the best saved model. --- examples/bert/bert_finetune_glue.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bert/bert_finetune_glue.py b/examples/bert/bert_finetune_glue.py index b7e378d657..598a09fb3b 100644 --- a/examples/bert/bert_finetune_glue.py +++ b/examples/bert/bert_finetune_glue.py @@ -13,6 +13,8 @@ # limitations under the License. """Run finetuning on a GLUE task.""" +import tempfile + import datasets import keras_tuner import tensorflow as tf @@ -251,6 +253,7 @@ def preprocess_data(inputs, labels): max_trials=4, overwrite=True, project_name="hyperparameter_tuner_results", + directory=tempfile.mkdtemp(), ) tuner.search(