From 48ad482d3d56ecf58afc55845d672f3a9e250dae 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