Skip to content

Commit 70cbaf6

Browse files
authored
workaround transfromers 4.50 loading issue with old torch (#2840)
CVS-164849
1 parent d96a432 commit 70cbaf6

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

notebooks/gemma3/gradio_helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def run(message: dict, history: list[dict], system_prompt: str = "", max_new_tok
250250
demo = gr.ChatInterface(
251251
fn=run,
252252
type="messages",
253-
chatbot=gr.Chatbot(type="messages", scale=1, allow_tags=["image"]),
253+
chatbot=gr.Chatbot(type="messages", scale=1),
254254
textbox=gr.MultimodalTextbox(file_types=["image", ".mp4"], file_count="multiple", autofocus=True),
255255
multimodal=True,
256256
additional_inputs=[

notebooks/got-ocr2/gradio_helper.py

-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None):
227227
)
228228
elif isinstance(img, np.ndarray):
229229
cv2.imwrite(image_path, cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
230-
elif isinstance(img, str):
231-
shutil.copy(img, image_path)
232230
else:
233231
return "Error: Unsupported image format", None, None
234232

notebooks/sound-generation-audioldm2/sound-generation-audioldm2.ipynb

+6-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@
6262
},
6363
"outputs": [],
6464
"source": [
65+
"import platform\n",
66+
"\n",
6567
"%pip install -qU accelerate \"diffusers>=0.30.0\" \"transformers>=4.43\" \"torch>=2.1\" \"gradio>=4.19\" \"peft>=0.6.2\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
66-
"%pip install -q \"openvino>=2024.0.0\""
68+
"%pip install -q \"openvino>=2024.0.0\"\n",
69+
"\n",
70+
"if platform.system() == \"Darwin\" and platform.processor() != \"arm\":\n",
71+
" %pip install \"numpy<2.0\" \"transformers>=4.43,<4.50\""
6772
]
6873
},
6974
{

notebooks/text-to-image-genai/text-to-image-genai.ipynb

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@
6363
"from pathlib import Path\n",
6464
"\n",
6565
"\n",
66-
"%pip install -q \"git+https://github.com/huggingface/optimum-intel.git\"\n",
67-
"\n",
6866
"%pip install -q -U \"openvino>=2025.0\" \"openvino-tokenizers>=2025.0\" \"openvino-genai>=2025.0\"\n",
6967
"%pip install -q -U \"transformers>=4.45\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
7068
"%pip install -q Pillow \"diffusers>=0.30.3\" \"gradio>=4.19\" \"typing_extensions>=4.9\" \"tqdm\"\n",
69+
"%pip install -q \"git+https://github.com/huggingface/optimum-intel.git\" --extra-index-url https://download.pytorch.org/whl/cpu\n",
7170
"if platform.system() == \"Darwin\":\n",
7271
" %pip install -q \"numpy<2.0.0\"\n",
7372
"\n",

notebooks/tiny-sd-image-generation/tiny-sd-image-generation.ipynb

+6-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@
7171
"metadata": {},
7272
"outputs": [],
7373
"source": [
74-
"%pip install -q --extra-index-url https://download.pytorch.org/whl/cpu \"torch>=2.1\" torchvision \"openvino>=2023.3.0\" \"opencv-python\" \"pillow\" \"diffusers>=0.18.0\" \"transformers>=4.45\" \"gradio>=4.19\""
74+
"import platform\n",
75+
"\n",
76+
"%pip install -q --extra-index-url https://download.pytorch.org/whl/cpu \"torch>=2.1\" torchvision \"openvino>=2023.3.0\" \"opencv-python\" \"pillow\" \"diffusers>=0.18.0\" \"transformers>=4.45\" \"gradio>=4.19\"\n",
77+
"\n",
78+
"if platform.system() == \"Darwin\" and platform.processor() != \"arm\":\n",
79+
" %pip install \"numpy<2.0\" \"transformers>=4.43,<4.50\""
7580
]
7681
},
7782
{

0 commit comments

Comments
 (0)