v3.0: fix push_to_hf.py to use path_in_repo=cnn_bigru
Browse files
cnn_bigru/scripts/push_to_hf.py
CHANGED
|
@@ -147,11 +147,15 @@ def delete_saved_model_state(project_dir: Path) -> None:
|
|
| 147 |
|
| 148 |
|
| 149 |
def upload_with_retry(api, folder: Path, repo_id: str, token: str, max_retries: int = 3):
|
| 150 |
-
"""Faz upload_folder com retry em caso de falha transit贸ria.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
last_error = None
|
| 152 |
for attempt in range(1, max_retries + 1):
|
| 153 |
try:
|
| 154 |
-
logger.info(f"Tentativa {attempt}/{max_retries}: upload_folder...")
|
| 155 |
commit_info = api.upload_folder(
|
| 156 |
folder_path=str(folder),
|
| 157 |
repo_id=repo_id,
|
|
@@ -159,6 +163,7 @@ def upload_with_retry(api, folder: Path, repo_id: str, token: str, max_retries:
|
|
| 159 |
token=token,
|
| 160 |
commit_message=f"v3.0: 9 novos m贸dulos (CyclicReasoning, Medusa, NLG, NLP, MMA, VQVAE2, W8A8, LongContext 1M, Monitor) + bug fixes (attempt {attempt})",
|
| 161 |
# Sobrescreve arquivos desatualizados (default)
|
|
|
|
| 162 |
)
|
| 163 |
logger.info(f"Upload bem-sucedido: {commit_info}")
|
| 164 |
return True, None
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
def upload_with_retry(api, folder: Path, repo_id: str, token: str, max_retries: int = 3):
|
| 150 |
+
"""Faz upload_folder com retry em caso de falha transit贸ria.
|
| 151 |
+
|
| 152 |
+
IMPORTANTE: usa path_in_repo='cnn_bigru' para preservar a 谩rvore de pastas
|
| 153 |
+
(todos os arquivos ficam sob cnn_bigru/ no repo HF, n茫o na raiz).
|
| 154 |
+
"""
|
| 155 |
last_error = None
|
| 156 |
for attempt in range(1, max_retries + 1):
|
| 157 |
try:
|
| 158 |
+
logger.info(f"Tentativa {attempt}/{max_retries}: upload_folder (path_in_repo='cnn_bigru')...")
|
| 159 |
commit_info = api.upload_folder(
|
| 160 |
folder_path=str(folder),
|
| 161 |
repo_id=repo_id,
|
|
|
|
| 163 |
token=token,
|
| 164 |
commit_message=f"v3.0: 9 novos m贸dulos (CyclicReasoning, Medusa, NLG, NLP, MMA, VQVAE2, W8A8, LongContext 1M, Monitor) + bug fixes (attempt {attempt})",
|
| 165 |
# Sobrescreve arquivos desatualizados (default)
|
| 166 |
+
path_in_repo="cnn_bigru", # PRESERVA 谩rvore de pastas
|
| 167 |
)
|
| 168 |
logger.info(f"Upload bem-sucedido: {commit_info}")
|
| 169 |
return True, None
|