23f2002275 commited on
Commit ·
7c57d97
1
Parent(s): e85f766
fix(notebook): install hf_transfer + clear HF_HUB_ENABLE_HF_TRANSFER to fix Colab download crash
Browse files
notebooks/fathom_train.ipynb
CHANGED
|
@@ -45,7 +45,11 @@
|
|
| 45 |
"metadata": {},
|
| 46 |
"outputs": [],
|
| 47 |
"source": [
|
| 48 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
"!pip install -q transformers==4.56.2 accelerate==1.5.2 peft==0.14.0 bitsandbytes==0.45.1 datasets==4.7.0\n",
|
| 50 |
"!pip install -q --no-deps trl==1.2.0\n",
|
| 51 |
"!pip install -q safetensors sentencepiece einops scipy xxhash protobuf pyyaml fsspec aiohttp dill multiprocess pyarrow\n",
|
|
@@ -64,6 +68,7 @@
|
|
| 64 |
"outputs": [],
|
| 65 |
"source": [
|
| 66 |
"import os\n",
|
|
|
|
| 67 |
"from huggingface_hub import snapshot_download, hf_hub_download\n",
|
| 68 |
"REPO = 'Pratham-math/fathom-code'\n",
|
| 69 |
"snapshot_download(repo_id=REPO, repo_type='model', local_dir='/content/fathom')\n",
|
|
@@ -100,10 +105,10 @@
|
|
| 100 |
" answer_regex='<answer>(.*?)</answer>'\n",
|
| 101 |
")\n",
|
| 102 |
"\n",
|
| 103 |
-
"good
|
| 104 |
"format_only_wrong = '<answer>Berlin</answer>'\n",
|
| 105 |
-
"no_format
|
| 106 |
-
"padded
|
| 107 |
"\n",
|
| 108 |
"for label, completion in [\n",
|
| 109 |
" ('correct', good),\n",
|
|
|
|
| 45 |
"metadata": {},
|
| 46 |
"outputs": [],
|
| 47 |
"source": [
|
| 48 |
+
"# Colab sets HF_HUB_ENABLE_HF_TRANSFER=1 but often lacks the package.\n",
|
| 49 |
+
"# Install it first, then clear the flag as a safety net so downloads never fail.\n",
|
| 50 |
+
"import os; os.environ.pop('HF_HUB_ENABLE_HF_TRANSFER', None)\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"!pip install -q hf_transfer 'huggingface_hub>=0.28' openenv-core fastapi 'uvicorn[standard]' pydantic RestrictedPython tiktoken httpx hydra-core omegaconf wandb tyro\n",
|
| 53 |
"!pip install -q transformers==4.56.2 accelerate==1.5.2 peft==0.14.0 bitsandbytes==0.45.1 datasets==4.7.0\n",
|
| 54 |
"!pip install -q --no-deps trl==1.2.0\n",
|
| 55 |
"!pip install -q safetensors sentencepiece einops scipy xxhash protobuf pyyaml fsspec aiohttp dill multiprocess pyarrow\n",
|
|
|
|
| 68 |
"outputs": [],
|
| 69 |
"source": [
|
| 70 |
"import os\n",
|
| 71 |
+
"os.environ.pop('HF_HUB_ENABLE_HF_TRANSFER', None) # ensure still cleared after pip restart\n",
|
| 72 |
"from huggingface_hub import snapshot_download, hf_hub_download\n",
|
| 73 |
"REPO = 'Pratham-math/fathom-code'\n",
|
| 74 |
"snapshot_download(repo_id=REPO, repo_type='model', local_dir='/content/fathom')\n",
|
|
|
|
| 105 |
" answer_regex='<answer>(.*?)</answer>'\n",
|
| 106 |
")\n",
|
| 107 |
"\n",
|
| 108 |
+
"good = '<answer>Paris</answer>'\n",
|
| 109 |
"format_only_wrong = '<answer>Berlin</answer>'\n",
|
| 110 |
+
"no_format = 'Paris'\n",
|
| 111 |
+
"padded = '<answer>Paris</answer>' + ' '*5000\n",
|
| 112 |
"\n",
|
| 113 |
"for label, completion in [\n",
|
| 114 |
" ('correct', good),\n",
|