You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add USE_MODEL_REGISTRY env var and run.sh for CI
Introduces an explicit USE_MODEL_REGISTRY flag to decouple model source
from Opik tracing. When unset (default), distilgpt2 loads from HuggingFace
so CI can run without CometML registry credentials while still sending
real traces to Opik. Both the script and notebook are updated to match.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"**Already have a registered model?** Skip straight to [Section 2](#section-2).\n",
31
31
"\n",
32
32
"---\n",
33
33
"\n",
34
-
"**Recommended runtime:** GPU (T4 or better). In Colab: *Runtime \u2192 Change runtime type \u2192 T4 GPU*."
34
+
"**Recommended runtime:** GPU (T4 or better). In Colab: *Runtime → Change runtime type → T4 GPU*."
35
35
],
36
36
"outputs": [],
37
37
"execution_count": null
@@ -61,7 +61,7 @@
61
61
"id": "cell-restart-note",
62
62
"metadata": {},
63
63
"source": [
64
-
"> **Note:** If you just installed the packages for the first time, restart the Colab runtime now (*Runtime \u2192 Restart session*) then run all cells again from the top."
64
+
"> **Note:** If you just installed the packages for the first time, restart the Colab runtime now (*Runtime → Restart session*) then run all cells again from the top."
65
65
],
66
66
"outputs": [],
67
67
"execution_count": null
@@ -72,7 +72,7 @@
72
72
"id": "cell-credentials",
73
73
"metadata": {},
74
74
"outputs": [],
75
-
"source": "import os\nimport getpass\n\n# CometML and Opik share the same workspace and API key on the Comet platform.\n# Locally: export COMET_API_KEY and COMET_WORKSPACE before running.\nAPI_KEY = os.environ.get('COMET_API_KEY', '') or getpass.getpass('Enter your Comet API key: ')\nWORKSPACE = os.environ.get('COMET_WORKSPACE', '') or getpass.getpass('Enter your Comet workspace: ')\n\n# Propagate to both SDKs\nos.environ['COMET_API_KEY'] = API_KEY\nos.environ['COMET_WORKSPACE'] = WORKSPACE\nos.environ['OPIK_API_KEY'] = API_KEY\nos.environ['OPIK_WORKSPACE'] = WORKSPACE\n\nCOMET_API_KEY = API_KEY\nCOMET_WORKSPACE = WORKSPACE\nOPIK_API_KEY = API_KEY\nOPIK_WORKSPACE = WORKSPACE\n\n# Update these to match your use case.\nREGISTRY_NAME = 'sft-distilgpt2'\nMODEL_VERSION = '1.0.0'\nOPIK_PROJECT = 'tracing-finetuned-models'\n\nprint(f'Workspace : {WORKSPACE or \"(not set)\"}')"
75
+
"source": "import os\nimport getpass\n\n# CometML and Opik share the same workspace and API key on the Comet platform.\n# Locally: export COMET_API_KEY and COMET_WORKSPACE before running.\nAPI_KEY = os.environ.get('COMET_API_KEY', '') or getpass.getpass('Enter your Comet API key: ')\nWORKSPACE = os.environ.get('COMET_WORKSPACE', '') or getpass.getpass('Enter your Comet workspace: ')\n\n# Propagate to both SDKs\nos.environ['COMET_API_KEY'] = API_KEY\nos.environ['COMET_WORKSPACE'] = WORKSPACE\nos.environ['OPIK_API_KEY'] = API_KEY\nos.environ['OPIK_WORKSPACE'] = WORKSPACE\n\nCOMET_API_KEY = API_KEY\nCOMET_WORKSPACE = WORKSPACE\nOPIK_API_KEY = API_KEY\nOPIK_WORKSPACE = WORKSPACE\n\n# Set to True to download the fine-tuned model from the CometML registry.\n# False (default) loads distilgpt2 directly from HuggingFace — Opik tracing still runs.\nUSE_MODEL_REGISTRY = os.environ.get('USE_MODEL_REGISTRY', 'false').lower() in ('1', 'true', 'yes')\n\n# Update these to match your registered model when USE_MODEL_REGISTRY=True.\nREGISTRY_NAME = 'sft-distilgpt2'\nMODEL_VERSION = '1.0.0'\nOPIK_PROJECT = 'tracing-finetuned-models'\n\nprint(f'Workspace : {WORKSPACE or \"(not set)\"}')\nprint(f'USE_MODEL_REGISTRY : {USE_MODEL_REGISTRY}')"
76
76
},
77
77
{
78
78
"cell_type": "markdown",
@@ -110,7 +110,7 @@
110
110
"source": [
111
111
"# comet_ml MUST be imported first.\n",
112
112
"os.environ['COMET_API_KEY'] = COMET_API_KEY or ''\n",
113
-
"import comet_ml # noqa: F401 \u2014 triggers auto-integration with Trainer"
113
+
"import comet_ml # noqa: F401 — triggers auto-integration with Trainer"
114
114
]
115
115
},
116
116
{
@@ -196,7 +196,7 @@
196
196
" metadata={'epoch': epoch},\n",
197
197
" )\n",
198
198
" shutil.rmtree(checkpoint_path)\n",
199
-
" print(f' \u2192 Logged checkpoint_epoch_{epoch} to CometML')"
199
+
" print(f' → Logged checkpoint_epoch_{epoch} to CometML')"
0 commit comments