File size: 3,190 Bytes
31f0e50 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | # IndicBERT Download Guide - Alternative Methods
Since you're having issues with transformers library, here are **3 alternative methods** to download IndicBERT:
---
## π Method 1: Using `huggingface_hub` (RECOMMENDED - Lightest)
**This is the SIMPLEST and LIGHTEST method - no transformers needed!**
### Step 1: Install huggingface_hub
```powershell
pip install huggingface_hub
```
### Step 2: Run the simple download script
```powershell
# Option A: Pass token as argument
python scripts/download_indicbert_simple.py your_token_here
# Option B: Set environment variable first
set HUGGINGFACE_TOKEN=your_token_here
python scripts/download_indicbert_simple.py
```
**That's it!** This will download the model files to your cache directory.
---
## π§ Method 2: Using Git LFS
If you have Git and Git LFS installed:
```powershell
# Install git-lfs (if not installed)
# Windows: Download from https://git-lfs.github.com/
# Then:
git lfs install
git clone https://your_token@huggingface.co/ai4bharat/indic-bert ./models/indic-bert
cd ./models/indic-bert
git lfs pull
```
---
## π Method 3: Direct API Download
Uses Python requests library to download files directly:
```powershell
python scripts/download_indicbert_alternative.py your_token_here
```
This script tries all 3 methods automatically.
---
## π What You Need to Provide
1. **Your HuggingFace Token**
- Get it from: https://huggingface.co/settings/tokens
- Should start with `hf_`
- Make sure it has "Read" permissions
2. **Model Access**
- Request access at: https://huggingface.co/ai4bharat/indic-bert
- Click "Agree and access repository"
- Wait for approval (usually instant)
---
## β
Quick Test
Once you have your token, test it:
```powershell
# Install the lightweight library
pip install huggingface_hub
# Test download
python scripts/download_indicbert_simple.py your_token_here
```
---
## π Troubleshooting
### Error: "401 Unauthorized"
- **Fix**: Check your token is correct
- **Fix**: Make sure you've requested access to the model
### Error: "Gated repository"
- **Fix**: Request access at https://huggingface.co/ai4bharat/indic-bert
- **Fix**: Wait for approval, then try again
### Error: "huggingface_hub not found"
- **Fix**: `pip install huggingface_hub`
### Error: "Model not found"
- **Fix**: Check model ID: `ai4bharat/indic-bert`
- **Fix**: Verify it exists at HuggingFace
---
## π Model Location After Download
After successful download, the model will be cached at:
- **Windows**: `C:\Users\<username>\.cache\huggingface\hub\models--ai4bharat--indic-bert`
- **Linux/Mac**: `~/.cache/huggingface/hub/models--ai4bharat--indic-bert`
You can use it later with:
```python
from transformers import AutoModel
model = AutoModel.from_pretrained("ai4bharat/indic-bert", token="your_token")
```
---
## π― Recommended Approach
**Use Method 1 (huggingface_hub)** - it's the simplest and doesn't require transformers!
```powershell
pip install huggingface_hub
python scripts/download_indicbert_simple.py your_token_here
```
|