Fix import error caused by pydantic on cpu (#11474)
This commit is contained in:
		
							parent
							
								
									dbba51f455
								
							
						
					
					
						commit
						48ad482d3d
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -32,7 +32,11 @@ logger = logging.getLogger(__name__)
 | 
				
			||||||
import asyncio
 | 
					import asyncio
 | 
				
			||||||
import uuid
 | 
					import uuid
 | 
				
			||||||
import threading
 | 
					import threading
 | 
				
			||||||
from pydantic import BaseModel
 | 
					try:
 | 
				
			||||||
 | 
					    from pydantic import BaseModel
 | 
				
			||||||
 | 
					except ImportError:
 | 
				
			||||||
 | 
					    from abc import ABCMeta
 | 
				
			||||||
 | 
					    BaseModel = ABCMeta
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# patch GenerationMixin.generate
 | 
					# patch GenerationMixin.generate
 | 
				
			||||||
from transformers import GenerationMixin
 | 
					from transformers import GenerationMixin
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue