Skip to content

Commit dc63a25

Browse files
committed
Addressing review feedback
1 parent c4e5c0d commit dc63a25

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

site/en/responsible/docs/safeguards/shieldgemma2_on_huggingface.ipynb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
},
106106
"outputs": [],
107107
"source": [
108+
"# @title install Hugging Face Transformers v4.50+\n",
108109
"! pip install -q 'transformers>=4.50.0'"
109110
]
110111
},
@@ -116,7 +117,19 @@
116117
},
117118
"outputs": [],
118119
"source": [
119-
"! huggingface-cli login"
120+
"# @title Authenticate with Hugging Face Hub\n",
121+
"# @markdown ShieldGemma is a gated model. To access the weights, you must accept\n",
122+
"# @markdown the license on Hugging Face Hub under your account and then provide\n",
123+
"# @markdown an [Access Token](https://huggingface.co/docs/hub/en/security-tokens)\n",
124+
"# @markdown to authenticate with the Hugging Face Hub API. If using Colab, the\n",
125+
"# @markdown easiest way to do this is by creating a read-only token specifically\n",
126+
"# @markdown for Colab and setting this as the value of the `HF_TOKEN` secret;\n",
127+
"# @markdown this token will then be reusable across all Colab notebooks. Other\n",
128+
"# @markdown Python notebook platforms may provide a similar mechanism. For those\n",
129+
"# @markdown that do not, un-comment the lines in this cell to install the\n",
130+
"# @markdown Hugging Face Hub CLI and login in interactively.\n",
131+
"# ! pip install -q 'huggingface_hub[cli]'\n",
132+
"# ! huggingface-cli login"
120133
]
121134
},
122135
{
@@ -188,7 +201,7 @@
188201
"\n",
189202
"# ShieldGemma prompts are constructed such that predicting the `Yes` token means\n",
190203
"# the content does violate the policy. If you are only interested in the\n",
191-
"# violative condition, use to extract that slice from the output tensors.\n",
204+
"# violative condition, you can extract only that slice from the output tensors.\n",
192205
"p_violated = scores.probabilities[:, 0]\n",
193206
"print(p_violated)\n"
194207
]

0 commit comments

Comments
 (0)