4343_RESET = "\033 [0m"
4444
4545
46+ def raise_if_space_is_frozen_for_logging (space_id : str ) -> None :
47+ try :
48+ info = huggingface_hub .HfApi ().space_info (space_id )
49+ except RepositoryNotFoundError :
50+ return
51+ if getattr (info , "sdk" , None ) == "static" :
52+ raise RuntimeError (
53+ f"Cannot log to Hugging Face Space '{ space_id } ' because it has been frozen "
54+ f"(it uses the static SDK: a read-only dashboard with no live Trackio server).\n \n "
55+ f"Use a different space_id for training, or create a new Gradio Trackio Space. "
56+ f"Freezing converts a live Gradio Space to static after a run; a frozen Space "
57+ f'cannot accept new logs. See trackio.sync(..., sdk="static") in the Trackio docs.'
58+ )
59+
60+
4661def _readme_linked_hub_yaml (dataset_id : str | None ) -> str :
4762 if dataset_id is not None :
4863 return f"datasets:\n - { dataset_id } \n "
@@ -709,6 +724,11 @@ def sync(
709724 Syncs a local Trackio project's database to a Hugging Face Space.
710725 If the Space does not exist, it will be created.
711726
727+ **Freezing:** Passing ``sdk="static"`` *freezes* the Space: it converts a live Gradio
728+ Space into a static Space backed by an HF Bucket (read-only dashboard, no Gradio
729+ server). You cannot log new metrics to a frozen Space; use a different ``space_id``
730+ or a new Gradio Space for further training runs.
731+
712732 Args:
713733 project (`str`): The name of the project to upload.
714734 space_id (`str`, *optional*): The ID of the Space to upload to (e.g., `"username/space_id"`).
@@ -725,7 +745,7 @@ def sync(
725745 If `False`, all the steps will be run synchronously.
726746 sdk (`str`, *optional*, defaults to `"gradio"`):
727747 The type of Space to deploy. `"gradio"` deploys a Gradio Space with a live
728- server. `"static"` deploys a static Space that reads from an HF Bucket
748+ server. `"static"` freezes the Space: deploys a static Space that reads from an HF Bucket
729749 (no server needed).
730750 dataset_id (`str`, *optional*):
731751 Deprecated. Use `bucket_id` instead.
0 commit comments