From c0b9f230f1918ba0761f2d800e80dd0939cffa1d Mon Sep 17 00:00:00 2001 From: hahunavth Date: Thu, 12 Oct 2023 17:25:49 +0700 Subject: [PATCH] Fix UnboundLocalError when using commit context manager --- src/huggingface_hub/repository.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/huggingface_hub/repository.py b/src/huggingface_hub/repository.py index d13b287aac..cfd722c324 100644 --- a/src/huggingface_hub/repository.py +++ b/src/huggingface_hub/repository.py @@ -1367,9 +1367,7 @@ def commit( files_to_stage = files_to_be_staged(".", folder=self.local_dir) if len(files_to_stage): - if len(files_to_stage) > 5: - files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" - + files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" if len(files_to_stage) > 5 else str(files_to_stage) logger.error( "There exists some updated files in the local repository that are not" f" committed: {files_in_msg}. This may lead to errors if checking out"