Skip to content

Commit

Permalink
Limit huggingface version to 0.21 in Keras notebooks (#1096)
Browse files Browse the repository at this point in the history
Limit huggingface version to 0.21 in Keras notebooks and add a condition for dataset download.
  • Loading branch information
Idan-BenAmi authored Jun 5, 2024
1 parent 2981dbd commit 3fcf49d
Show file tree
Hide file tree
Showing 5 changed files with 642 additions and 627 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"outputs": [],
"source": [
"!pip install -q tensorflow\n",
"!pip install -q pycocotools"
"!pip install -q pycocotools\n",
"!pip install 'huggingface-hub<=0.21.4'"
],
"metadata": {
"collapsed": false
Expand All @@ -66,6 +67,7 @@
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"import importlib\n",
"\n",
"if not importlib.util.find_spec('model_compression_toolkit'):\n",
Expand Down Expand Up @@ -93,12 +95,13 @@
"execution_count": null,
"outputs": [],
"source": [
"!wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
"!unzip -q -o annotations_trainval2017.zip -d ./coco\n",
"!echo Done loading annotations\n",
"!wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
"!unzip -q -o val2017.zip -d ./coco\n",
"!echo Done loading val2017 images"
"if not os.path.isdir('coco'):\n",
" !wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
" !unzip -q -o annotations_trainval2017.zip -d ./coco\n",
" !echo Done loading annotations\n",
" !wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
" !unzip -q -o val2017.zip -d ./coco\n",
" !echo Done loading val2017 images"
],
"metadata": {
"collapsed": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"outputs": [],
"source": [
"!pip install -q tensorflow\n",
"!pip install 'huggingface-hub<=0.21.4'\n",
"\n",
"import importlib\n",
"\n",
"if not importlib.util.find_spec('model_compression_toolkit'):\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"outputs": [],
"source": [
"!pip install -q tensorflow\n",
"!pip install -q pycocotools"
"!pip install -q pycocotools\n",
"!pip install 'huggingface-hub<=0.21.4'"
],
"metadata": {
"collapsed": false
Expand All @@ -66,6 +67,7 @@
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"import importlib\n",
"\n",
"if not importlib.util.find_spec('model_compression_toolkit'):\n",
Expand Down Expand Up @@ -93,12 +95,13 @@
"execution_count": null,
"outputs": [],
"source": [
"!wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
"!unzip -q -o annotations_trainval2017.zip -d ./coco\n",
"!echo Done loading annotations\n",
"!wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
"!unzip -q -o val2017.zip -d ./coco\n",
"!echo Done loading val2017 images"
"if not os.path.isdir('coco'):\n",
" !wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
" !unzip -q -o annotations_trainval2017.zip -d ./coco\n",
" !echo Done loading annotations\n",
" !wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
" !unzip -q -o val2017.zip -d ./coco\n",
" !echo Done loading val2017 images"
],
"metadata": {
"collapsed": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"import importlib\n",
"\n",
"if not importlib.util.find_spec('model_compression_toolkit'):\n",
" !pip install mct-nightly\n",
" !pip install model_compression_toolkit\n",
"!git clone https://github.com/sony/model_optimization.git temp_mct && mv temp_mct/tutorials . && \\rm -rf temp_mct\n",
"sys.path.insert(0,\"tutorials\")"
]
Expand All @@ -101,12 +102,13 @@
},
"outputs": [],
"source": [
"!wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
"!unzip -q -o annotations_trainval2017.zip -d ./coco\n",
"!echo Done loading annotations\n",
"!wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
"!unzip -q -o val2017.zip -d ./coco\n",
"!echo Done loading val2017 images"
"if not os.path.isdir('coco'):\n",
" !wget -nc http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n",
" !unzip -q -o annotations_trainval2017.zip -d ./coco\n",
" !echo Done loading annotations\n",
" !wget -nc http://images.cocodataset.org/zips/val2017.zip\n",
" !unzip -q -o val2017.zip -d ./coco\n",
" !echo Done loading val2017 images"
]
},
{
Expand Down
Loading

0 comments on commit 3fcf49d

Please sign in to comment.