Ark-kun commited on
Commit
b9249db
·
1 Parent(s): 2ea3fe0

fixup: Create artifacts repo if needed

Browse files
huggingface_overlay/start_HuggingFace.py CHANGED
@@ -137,12 +137,16 @@ if IS_HUGGINGFACE_SPACE:
137
  repo_type=repo_type,
138
  )
139
  repo_exists = True
 
140
 
 
 
141
  except Exception as ex:
142
  raise RuntimeError(
143
  f"Error checking for the artifacts repo existence. {artifacts_repo_id=}"
144
  ) from ex
145
  if not repo_exists:
 
146
  try:
147
  _ = huggingface_hub.create_repo(
148
  repo_id=artifacts_repo_id,
@@ -150,12 +154,12 @@ if IS_HUGGINGFACE_SPACE:
150
  private=True,
151
  exist_ok=True,
152
  )
153
- artifacts_root_uri = proposed_artifacts_root_uri
154
- logs_root_uri = artifacts_root_uri
155
  except Exception as ex:
156
  raise RuntimeError(
157
  f"Error creating the artifacts repo. {artifacts_repo_id=}"
158
  ) from ex
 
 
159
 
160
  print(f"{artifacts_root_uri=}")
161
 
 
137
  repo_type=repo_type,
138
  )
139
  repo_exists = True
140
+ print(f"Artifact repo exists: {artifacts_repo_id}")
141
 
142
+ except huggingface_hub.errors.RepositoryNotFoundError:
143
+ pass
144
  except Exception as ex:
145
  raise RuntimeError(
146
  f"Error checking for the artifacts repo existence. {artifacts_repo_id=}"
147
  ) from ex
148
  if not repo_exists:
149
+ print(f"Artifact repo does not exist. Creating it: {artifacts_repo_id}")
150
  try:
151
  _ = huggingface_hub.create_repo(
152
  repo_id=artifacts_repo_id,
 
154
  private=True,
155
  exist_ok=True,
156
  )
 
 
157
  except Exception as ex:
158
  raise RuntimeError(
159
  f"Error creating the artifacts repo. {artifacts_repo_id=}"
160
  ) from ex
161
+ artifacts_root_uri = proposed_artifacts_root_uri
162
+ logs_root_uri = artifacts_root_uri
163
 
164
  print(f"{artifacts_root_uri=}")
165