From f239018df7b4a0916da562652107509abcd51598 Mon Sep 17 00:00:00 2001 From: binbin Deng <108676127+plusbang@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:49:49 +0800 Subject: [PATCH] Fix import error caused by pydantic on cpu (#11474) --- python/llm/src/ipex_llm/transformers/pipeline_parallel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/llm/src/ipex_llm/transformers/pipeline_parallel.py b/python/llm/src/ipex_llm/transformers/pipeline_parallel.py index 6db55d536cc..076154490ac 100644 --- a/python/llm/src/ipex_llm/transformers/pipeline_parallel.py +++ b/python/llm/src/ipex_llm/transformers/pipeline_parallel.py @@ -32,7 +32,11 @@ import asyncio import uuid import threading -from pydantic import BaseModel +try: + from pydantic import BaseModel +except ImportError: + from abc import ABCMeta + BaseModel = ABCMeta # patch GenerationMixin.generate from transformers import GenerationMixin