diff --git a/llmfoundry/callbacks/hf_checkpointer.py b/llmfoundry/callbacks/hf_checkpointer.py index fe0847c3b5..51d012483f 100644 --- a/llmfoundry/callbacks/hf_checkpointer.py +++ b/llmfoundry/callbacks/hf_checkpointer.py @@ -76,6 +76,11 @@ def _maybe_get_license_filename( If the license file does not exist, returns None. """ + # Early return if no local directory exists + if not os.path.exists(local_dir): + return None + + # Try to find the license file try: license_filename = next( file for file in os.listdir(local_dir)