Spaces:
Sleeping
Timestamp every revision entry, and say "latest" not "dernier"
Browse filesThe main entry read "main (dernier)" with no date while the commit rows
carried one, so the option that actually tracks the tip was the only one you
could not date. It now reports the tip commit's timestamp, and the label is
English -- "latest" reads as the ref-that-moves, like a latest tag.
Commit rows were %Y-%m-%d only, which is not enough resolution here: the two
top commits of the MiniLM repo are 2 seconds apart, so a whole training run
was indistinguishable from the one before it. Every row now carries date and
time through a single config.stamp, which the model line under the pickers
uses too -- three timestamps, one format, all UTC.
Labels changed but values did not, so a selected sha survives the refresh.
Empty repo degrades to a bare "main (latest)" with no dangling separator.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- README.md +5 -0
- app/config.py +6 -0
- app/hub.py +4 -3
- app/text.py +2 -2
|
@@ -64,6 +64,11 @@ menus et suit le dépôt sélectionné, ce qui rend le choix par défaut lisible
|
|
| 64 |
Attention, `last_modified` vaut pour le dépôt entier — une correction de
|
| 65 |
README suffit à déplacer le choix par défaut, et la date affichée le montre.
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
Les deux sorties de `train.py` sont acceptées : la présence de `model_head.pkl`
|
| 68 |
sélectionne le chemin SetFit, sinon le modèle est chargé comme un
|
| 69 |
`AutoModelForSequenceClassification`.
|
|
|
|
| 64 |
Attention, `last_modified` vaut pour le dépôt entier — une correction de
|
| 65 |
README suffit à déplacer le choix par défaut, et la date affichée le montre.
|
| 66 |
|
| 67 |
+
Chaque entrée du menu des révisions porte son horodatage, `main (latest)`
|
| 68 |
+
compris, qui reprend celui du commit de tête — deux entraînements poussés le
|
| 69 |
+
même jour restent donc distinguables. Un seul format partout,
|
| 70 |
+
`%Y-%m-%d %H:%M` en UTC (`config.stamp`).
|
| 71 |
+
|
| 72 |
Les deux sorties de `train.py` sont acceptées : la présence de `model_head.pkl`
|
| 73 |
sélectionne le chemin SetFit, sinon le modèle est chargé comme un
|
| 74 |
`AutoModelForSequenceClassification`.
|
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
|
| 3 |
ORG = "bee2link"
|
| 4 |
MODEL_SEARCH = "breakdown-risk-"
|
|
@@ -12,3 +13,8 @@ LABEL_NAMES = {"risk": "Risque de panne", "no_risk": "Pas de risque"}
|
|
| 12 |
|
| 13 |
def display(label: str) -> str:
|
| 14 |
return LABEL_NAMES.get(label, label)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
from datetime import datetime
|
| 3 |
|
| 4 |
ORG = "bee2link"
|
| 5 |
MODEL_SEARCH = "breakdown-risk-"
|
|
|
|
| 13 |
|
| 14 |
def display(label: str) -> str:
|
| 15 |
return LABEL_NAMES.get(label, label)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def stamp(when: datetime) -> str:
|
| 19 |
+
"""One timestamp format everywhere; the Hub hands us UTC."""
|
| 20 |
+
return f"{when:%Y-%m-%d %H:%M}"
|
|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
| 4 |
|
| 5 |
from huggingface_hub import HfApi, hf_hub_download
|
| 6 |
|
| 7 |
-
from .config import MODEL_SEARCH, ORG, TOKEN
|
| 8 |
|
| 9 |
api = HfApi(token=TOKEN)
|
| 10 |
|
|
@@ -32,11 +32,12 @@ def revisions(repo: str) -> list[tuple[str, str]]:
|
|
| 32 |
if not repo:
|
| 33 |
return []
|
| 34 |
commits = api.list_repo_commits(repo, token=TOKEN)
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
def _commit_choice(commit) -> tuple[str, str]:
|
| 39 |
-
label = f"{commit.commit_id[:7]} · {commit.title[:44]} · {commit.created_at
|
| 40 |
return label, commit.commit_id
|
| 41 |
|
| 42 |
|
|
|
|
| 4 |
|
| 5 |
from huggingface_hub import HfApi, hf_hub_download
|
| 6 |
|
| 7 |
+
from .config import MODEL_SEARCH, ORG, TOKEN, stamp
|
| 8 |
|
| 9 |
api = HfApi(token=TOKEN)
|
| 10 |
|
|
|
|
| 32 |
if not repo:
|
| 33 |
return []
|
| 34 |
commits = api.list_repo_commits(repo, token=TOKEN)
|
| 35 |
+
tip = f" · {stamp(commits[0].created_at)}" if commits else ""
|
| 36 |
+
return [(f"main (latest){tip}", "main"), *(_commit_choice(c) for c in commits)]
|
| 37 |
|
| 38 |
|
| 39 |
def _commit_choice(commit) -> tuple[str, str]:
|
| 40 |
+
label = f"{commit.commit_id[:7]} · {commit.title[:44]} · {stamp(commit.created_at)}"
|
| 41 |
return label, commit.commit_id
|
| 42 |
|
| 43 |
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from datetime import datetime
|
| 2 |
|
| 3 |
-
from .config import CALLER_TURNS, DATASET_REPO, ORG
|
| 4 |
|
| 5 |
HEADER = f"""
|
| 6 |
# Risque d'immobilisation
|
|
@@ -30,4 +30,4 @@ def pushed_at(when: datetime | None) -> str:
|
|
| 30 |
"""Line under the pickers: when the selected repo was last touched."""
|
| 31 |
if when is None:
|
| 32 |
return ""
|
| 33 |
-
return f"<sub>Dépôt mis à jour le {when
|
|
|
|
| 1 |
from datetime import datetime
|
| 2 |
|
| 3 |
+
from .config import CALLER_TURNS, DATASET_REPO, ORG, stamp
|
| 4 |
|
| 5 |
HEADER = f"""
|
| 6 |
# Risque d'immobilisation
|
|
|
|
| 30 |
"""Line under the pickers: when the selected repo was last touched."""
|
| 31 |
if when is None:
|
| 32 |
return ""
|
| 33 |
+
return f"<sub>Dépôt mis à jour le {stamp(when)} UTC</sub>"
|