Spaces:
Running
Running
fix repo_id bug
Browse files
engine.py
CHANGED
|
@@ -414,29 +414,33 @@ class FunctionGemmaEngine:
|
|
| 414 |
|
| 415 |
try:
|
| 416 |
api = HfApi(token=oauth_token)
|
| 417 |
-
|
| 418 |
-
#
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
# Upload
|
| 426 |
-
print(f"Uploading to {
|
| 427 |
-
api.upload_folder(
|
| 428 |
folder_path=str(self.output_dir),
|
| 429 |
-
repo_id=
|
| 430 |
repo_type="model"
|
| 431 |
)
|
| 432 |
|
| 433 |
info = model_info(
|
| 434 |
-
repo_id=
|
| 435 |
token=oauth_token
|
| 436 |
)
|
| 437 |
tags = info.card_data.tags
|
| 438 |
tags.append("functiongemma-tuning-lab")
|
| 439 |
-
metadata_update(
|
| 440 |
|
| 441 |
return f"✅ Success! Model uploaded to: {repo_url}"
|
| 442 |
except Exception as e:
|
|
|
|
| 414 |
|
| 415 |
try:
|
| 416 |
api = HfApi(token=oauth_token)
|
| 417 |
+
|
| 418 |
+
# Get the authenticated user's username
|
| 419 |
+
user_info = api.whoami()
|
| 420 |
+
username = user_info['name']
|
| 421 |
+
|
| 422 |
+
# Construct the full repo ID
|
| 423 |
+
repo_id = f"{username}/{repo_name}"
|
| 424 |
+
print(f"Preparing to upload to: {repo_id}")
|
| 425 |
+
|
| 426 |
+
# Create the repo (safe if it already exists)
|
| 427 |
+
api.create_repo(repo_id=repo_id, exist_ok=True)
|
| 428 |
|
| 429 |
# Upload
|
| 430 |
+
print(f"Uploading to {repo_id}...")
|
| 431 |
+
repo_url = api.upload_folder(
|
| 432 |
folder_path=str(self.output_dir),
|
| 433 |
+
repo_id=repo_id,
|
| 434 |
repo_type="model"
|
| 435 |
)
|
| 436 |
|
| 437 |
info = model_info(
|
| 438 |
+
repo_id=repo_id,
|
| 439 |
token=oauth_token
|
| 440 |
)
|
| 441 |
tags = info.card_data.tags
|
| 442 |
tags.append("functiongemma-tuning-lab")
|
| 443 |
+
metadata_update(repo_id, {"tags": tags}, overwrite=True, token=oauth_token)
|
| 444 |
|
| 445 |
return f"✅ Success! Model uploaded to: {repo_url}"
|
| 446 |
except Exception as e:
|