From 64bdbd888c78dcef5aeaeabc842e12981c8aae7a Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Mon, 15 Jan 2024 11:38:20 +0100 Subject: [PATCH] Don't set `finetuned_from` if it is a local path (#28482) * fix * fix --------- Co-authored-by: ydshieh --- examples/pytorch/contrastive-image-text/run_clip.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/pytorch/contrastive-image-text/run_clip.py b/examples/pytorch/contrastive-image-text/run_clip.py index d9ead22810d2fc..a6c1551316daec 100644 --- a/examples/pytorch/contrastive-image-text/run_clip.py +++ b/examples/pytorch/contrastive-image-text/run_clip.py @@ -559,7 +559,11 @@ def filter_corrupt_images(examples): trainer.save_metrics("eval", metrics) # 11. Write Training Stats and push to hub. - kwargs = {"finetuned_from": model_args.model_name_or_path, "tasks": "contrastive-image-text-modeling"} + finetuned_from = model_args.model_name_or_path + # If from a local directory, don't set `finetuned_from` as this is required to be a valid repo. id on the Hub. + if os.path.isdir(finetuned_from): + finetuned_from = None + kwargs = {"finetuned_from": finetuned_from, "tasks": "contrastive-image-text-modeling"} if data_args.dataset_name is not None: kwargs["dataset_tags"] = data_args.dataset_name if data_args.dataset_config_name is not None: