Skip to content

Commit

Permalink
triposr correct torchvision version (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Jul 26, 2024
1 parent 2f8c515 commit 3bf4518
Showing 1 changed file with 45 additions and 20 deletions.
65 changes: 45 additions & 20 deletions notebooks/triposr-3d-reconstruction/triposr-3d-reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
},
"outputs": [],
"source": [
"%pip install -q \"gradio>=4.19\" \"torch==2.2.2\" rembg trimesh einops \"omegaconf>=2.3.0\" \"transformers>=4.35.0\" \"openvino>=2024.0.0\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q \"git+https://github.com/tatsy/torchmcubes.git\""
"%pip install -q \"gradio>=4.19\" \"torch==2.2.2\" \"torchvision<0.18.0\" rembg trimesh einops \"omegaconf>=2.3.0\" \"transformers>=4.35.0\" \"openvino>=2024.0.0\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q \"git+https://github.com/tatsy/torchmcubes.git\" --extra-index-url https://download.pytorch.org/whl/cpu"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "b78424b7-80e4-4470-9427-7286b9837566",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -101,7 +101,7 @@
" weight_name=\"model.ckpt\",\n",
")\n",
"model.renderer.set_chunk_size(131072)\n",
"model.to(\"cpu\")"
"model.to(\"cpu\");"
]
},
{
Expand All @@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "d37dbcee-8c40-4cf6-a1ed-5b4c2358f4d3",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -157,10 +157,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "d9456c3c-64dd-4109-968c-8f51d42b9876",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ea/miniconda3/lib/python3.11/site-packages/transformers/models/vit/modeling_vit.py:163: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!\n",
" if num_channels != self.num_channels:\n"
]
}
],
"source": [
"VIT_PATCH_EMBEDDINGS_OV_PATH = Path(\"models/vit_patch_embeddings_ir.xml\")\n",
"\n",
Expand Down Expand Up @@ -188,7 +197,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "f31d0b34-9690-454c-b497-f2330d18bac4",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -229,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "07815ea4-f851-4c13-99b9-1b905ef998cf",
"metadata": {},
"outputs": [],
Expand All @@ -244,7 +253,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "465dc1db-5ce1-428f-bc90-740aa6d0dca5",
"metadata": {},
"outputs": [],
Expand All @@ -255,7 +264,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "4b7cdbc5-ed39-49b4-922d-95603478209f",
"metadata": {},
"outputs": [],
Expand All @@ -271,7 +280,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "b209191b-5566-48ad-adb4-0ceee5d4e469",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -303,10 +312,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "9324143f-02b5-4238-a173-4a649d9ab1d5",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7986388de70945238d4407af5c60c348",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Dropdown(description='Device:', index=1, options=('CPU', 'AUTO'), value='AUTO')"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import ipywidgets as widgets\n",
"\n",
Expand All @@ -324,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"id": "379a2cb2-6086-47d9-ae83-be7f74a5c14f",
"metadata": {},
"outputs": [],
Expand All @@ -348,7 +373,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "7f97d859-4e2d-4277-8816-7ca8d6c76778",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -454,7 +479,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"id": "04ada5f4-6a4a-418d-8227-379b76e3faf1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -525,7 +550,7 @@
"\n",
"\n",
"def generate(image):\n",
" scene_codes = model(image, \"cpu\") # the device is provided for the image processor\n",
" scene_codes = model(image, \"cpu\") # the device is provided for the image processorit is\n",
" mesh = model.extract_mesh(scene_codes)[0]\n",
" mesh = to_gradio_3d_orientation(mesh)\n",
" mesh_path = tempfile.NamedTemporaryFile(suffix=\".obj\", delete=False)\n",
Expand Down Expand Up @@ -593,7 +618,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -607,7 +632,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/VAST-AI-Research/TripoSR/blob/main/figures/teaser800.gif?raw=true",
Expand Down

0 comments on commit 3bf4518

Please sign in to comment.