Update README.md
Browse files
README.md
CHANGED
|
@@ -139,6 +139,47 @@ Users must log in to their Hugging Face account and obtain access permission bef
|
|
| 139 |
|
| 140 |
For convenience and reproducibility, we recommend downloading MentalBERT locally and replacing the MentalBERT path in the code with the local checkpoint path.
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
```python
|
| 144 |
import torch
|
|
|
|
| 139 |
|
| 140 |
For convenience and reproducibility, we recommend downloading MentalBERT locally and replacing the MentalBERT path in the code with the local checkpoint path.
|
| 141 |
|
| 142 |
+
#### 🔐 How to Obtain a Hugging Face Access Token
|
| 143 |
+
|
| 144 |
+
To download and use gated models (e.g., mental/mental-bert-base-uncased), you need a Hugging Face account and a valid **access token**.
|
| 145 |
+
|
| 146 |
+
Please follow the steps below:
|
| 147 |
+
|
| 148 |
+
**Step 1: Create a Hugging Face Account**
|
| 149 |
+
|
| 150 |
+
If you do not already have one, create an account at:
|
| 151 |
+
- https://huggingface.co/join
|
| 152 |
+
|
| 153 |
+
**Step 2: Generate an Access Token**
|
| 154 |
+
|
| 155 |
+
1. Log in to your Hugging Face account.
|
| 156 |
+
2. Go to **Settings → Access Tokens**.
|
| 157 |
+
3. Click **“Create new token”**.
|
| 158 |
+
4. Choose **Read** permission (this is sufficient for downloading models).
|
| 159 |
+
5. Give the token a name (e.g., `mental-bert-access`).
|
| 160 |
+
6. Click **Create token** and copy the token.
|
| 161 |
+
|
| 162 |
+
⚠️ Keep your token private. Do not share it or commit it to public repositories.
|
| 163 |
+
|
| 164 |
+
**Step 3: Log In Programmatically**
|
| 165 |
+
|
| 166 |
+
Before loading the model, log in using the Hugging Face Hub API:
|
| 167 |
+
|
| 168 |
+
```python
|
| 169 |
+
from huggingface_hub import login
|
| 170 |
+
|
| 171 |
+
login() # Paste your access token when prompted
|
| 172 |
+
```
|
| 173 |
+
This step is required when running code in online environments such as **Google Colab** or remote servers.
|
| 174 |
+
|
| 175 |
+
**Step 4: Request Access to MentalBERT**
|
| 176 |
+
|
| 177 |
+
The model `mental/mental-bert-base-uncased` is a gated repository.
|
| 178 |
+
You must explicitly request access on its Hugging Face model page:
|
| 179 |
+
|
| 180 |
+
- https://huggingface.co/mental/mental-bert-base-uncased
|
| 181 |
+
|
| 182 |
+
Once access is granted, you will be able to download the model using your access token.
|
| 183 |
|
| 184 |
```python
|
| 185 |
import torch
|