Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clone_repo usage #2520

Open
wants to merge 9 commits into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions notebooks/animate-anyone/animate-anyone.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@
"import requests\n",
"\n",
"\n",
"REPO_PATH = Path(\"Moore-AnimateAnyone\")\n",
"if not REPO_PATH.exists():\n",
" !git clone -q \"https://github.com/itrushkin/Moore-AnimateAnyone.git\"\n",
"%pip install -q \"torch>=2.1\" torchvision einops omegaconf \"diffusers<=0.24\" \"huggingface-hub<0.26.0\" transformers av accelerate \"gradio>=4.19\" --extra-index-url \"https://download.pytorch.org/whl/cpu\"\n",
"%pip install -q \"openvino>=2024.0\" \"nncf>=2.9.0\"\n",
"\n",
"import sys\n",
"\n",
"sys.path.insert(0, str(REPO_PATH.resolve()))\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/skip_kernel_extension.py\",\n",
")\n",
Expand All @@ -94,6 +89,16 @@
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
")\n",
"open(\"cmd_helper.py\", \"w\").write(r.text)\n",
"\n",
"\n",
"from cmd_helper import clone_repo\n",
"\n",
"clone_repo(\"https://github.com/itrushkin/Moore-AnimateAnyone.git\")\n",
"\n",
"%load_ext skip_kernel_extension"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,39 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "d05fb71c-8f34-4f9d-b52f-033b67a52ea6",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import sys\n",
"from pathlib import Path\n",
"import requests\n",
"\n",
"repo_dir = Path(\"DDColor\")\n",
"\n",
"if not repo_dir.exists():\n",
" !git clone https://github.com/piddnad/DDColor.git\n",
"\n",
"sys.path.append(str(repo_dir))\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)"
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
")\n",
"open(\"cmd_helper.py\", \"w\").write(r.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "63e0bd42",
"metadata": {},
"outputs": [],
"source": [
"from cmd_helper import clone_repo\n",
"\n",
"\n",
"clone_repo(\"https://github.com/piddnad/DDColor.git\")"
]
},
{
Expand Down
54 changes: 33 additions & 21 deletions notebooks/depth-anything/depth-anything-v2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,35 @@
{
"cell_type": "code",
"execution_count": null,
"id": "243c8e5f",
"id": "813dcec8",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import requests\n",
"\n",
"\n",
"repo_dir = Path(\"Depth-Anything-V2\")\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"if not repo_dir.exists():\n",
" !git clone https://huggingface.co/spaces/depth-anything/Depth-Anything-V2\n",
"%cd Depth-Anything-V2"
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
")\n",
"open(\"cmd_helper.py\", \"w\").write(r.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "243c8e5f",
"metadata": {},
"outputs": [],
"source": [
"from cmd_helper import clone_repo\n",
"\n",
"\n",
"clone_repo(\"https://huggingface.co/spaces/depth-anything/Depth-Anything-V2\")"
]
},
{
Expand All @@ -87,9 +104,10 @@
"source": [
"import platform\n",
"\n",
"\n",
"%pip install -q \"openvino>=2024.2.0\" \"datasets>=2.14.6\" \"nncf>=2.11.0\" \"tqdm\" \"matplotlib>=3.4\"\n",
"%pip install -q \"typing-extensions>=4.9.0\" eval-type-backport \"gradio>=4.19\"\n",
"%pip install -q -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q \"typing-extensions>=4.9.0\" eval-type-backport \"gradio>=4.19\" gradio_imageslider\n",
"%pip install -q torch torchvision \"opencv-python\" huggingface_hub --extra-index-url https://download.pytorch.org/whl/cpu\n",
"\n",
"if platform.python_version_tuple()[1] in [\"8\", \"9\"]:\n",
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\""
Expand All @@ -116,12 +134,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "afcf2907-f5f4-4f21-9a3e-6cbe5bbd931a",
"metadata": {},
"outputs": [],
"source": [
"attention_file_path = Path(\"./depth_anything_v2/dinov2_layers/attention.py\")\n",
"from pathlib import Path\n",
"\n",
"\n",
"attention_file_path = Path(\"./Depth-Anything-V2/depth_anything_v2/dinov2_layers/attention.py\")\n",
"orig_attention_path = attention_file_path.parent / (\"orig_\" + attention_file_path.name)\n",
"\n",
"if not orig_attention_path.exists():\n",
Expand All @@ -146,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f834c75f-3e5c-475e-8c1b-9d5d53e7b342",
"metadata": {},
"outputs": [
Expand All @@ -171,15 +192,9 @@
"source": [
"from PIL import Image\n",
"\n",
"import requests\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"from notebook_utils import download_file, device_widget, quantization_widget\n",
"\n",
"\n",
"download_file(\n",
" \"https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/3f779fc1-c1b2-4dec-915a-64dae510a2bb\",\n",
" \"furseal.png\",\n",
Expand Down Expand Up @@ -1477,9 +1492,6 @@
"metadata": {},
"outputs": [],
"source": [
"# Go back to the depth-anything notebook directory\n",
"%cd ..\n",
"\n",
"if not Path(\"gradio_helper.py\").exists():\n",
" r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/depth-anything/gradio_helper.py\")\n",
" open(\"gradio_helper.py\", \"w\").write(r.text)\n",
Expand Down
51 changes: 40 additions & 11 deletions notebooks/depth-anything/depth-anything.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,50 @@
"[back to top ⬆️](#Table-of-contents:)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ad7e1312",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
")\n",
"open(\"cmd_helper.py\", \"w\").write(r.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8751144",
"metadata": {},
"outputs": [],
"source": [
"from cmd_helper import clone_repo\n",
"\n",
"\n",
"repo_dir = clone_repo(\"https://github.com/LiheYoung/Depth-Anything\")\n",
"\n",
"%cd $repo_dir"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8633459d-546c-4bca-a0fd-e8fe81dbed27",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import platform\n",
"\n",
"repo_dir = Path(\"Depth-Anything\")\n",
"\n",
"if not repo_dir.exists():\n",
" !git clone https://github.com/LiheYoung/Depth-Anything\n",
"%cd Depth-Anything\n",
"\n",
"%pip install -q \"openvino>=2023.3.0\" \"datasets>=2.14.6\" \"nncf\" \"tqdm\"\n",
"%pip install -q \"typing-extensions>=4.9.0\" eval-type-backport \"gradio>=4.19\" \"matplotlib>=3.4\"\n",
"%pip install -q -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q torch torchvision \"opencv-python\" huggingface_hub --extra-index-url https://download.pytorch.org/whl/cpu\n",
"\n",
"if platform.python_version_tuple()[1] in [\"8\", \"9\"]:\n",
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\""
Expand All @@ -100,11 +125,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "afcf2907-f5f4-4f21-9a3e-6cbe5bbd931a",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"\n",
"attention_file_path = Path(\"./torchhub/facebookresearch_dinov2_main/dinov2/layers/attention.py\")\n",
"orig_attention_path = attention_file_path.parent / (\"orig_\" + attention_file_path.name)\n",
"\n",
Expand Down Expand Up @@ -167,7 +195,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f834c75f-3e5c-475e-8c1b-9d5d53e7b342",
"metadata": {},
"outputs": [
Expand All @@ -194,15 +222,16 @@
"source": [
"from PIL import Image\n",
"\n",
"import requests\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"\n",
"from notebook_utils import download_file, device_widget, quantization_widget\n",
"\n",
"\n",
"download_file(\n",
" \"https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/3f779fc1-c1b2-4dec-915a-64dae510a2bb\",\n",
" \"furseal.png\",\n",
Expand Down
36 changes: 17 additions & 19 deletions notebooks/efficient-sam/efficient-sam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,39 @@
},
{
"cell_type": "code",
"execution_count": 2,
"id": "cc399f1d-f489-4001-ac58-a859332207d3",
"execution_count": null,
"id": "2ca5e78a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/home/ea/work/openvino_notebooks/notebooks/efficient-sam/EfficientSAM\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"from pathlib import Path\n",
"\n",
"repo_dir = Path(\"EfficientSAM\")\n",
"\n",
"if not repo_dir.exists():\n",
" !git clone https://github.com/yformer/EfficientSAM.git\n",
"%cd $repo_dir"
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
")\n",
"open(\"cmd_helper.py\", \"w\").write(r.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2ca5e78a",
"id": "5cc989a4",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"from cmd_helper import clone_repo\n",
"\n",
"\n",
"repo_dir = clone_repo(\"https://github.com/yformer/EfficientSAM.git\")\n",
"\n",
"%cd $repo_dir\n",
"\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import download_file, device_widget, quantization_widget # noqa: F401"
Expand All @@ -131,7 +129,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "f4177b95-acda-4595-b46a-cd725a04cfd2",
"metadata": {},
"outputs": [],
Expand Down
Loading
Loading