Control sys.modules ipex duplicate check with BIGDL_CHECK_DUPLICATE_IMPORT (#11453)
* Control sys.modules ipex duplicate check with BIGDL_CHECK_DUPLICATE_IMPORT。
This commit is contained in:
		
							parent
							
								
									c6e5ad668d
								
							
						
					
					
						commit
						4e4ecd5095
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -124,9 +124,10 @@ class IPEXImporter:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if self.is_xpu_version_installed():
 | 
					        if self.is_xpu_version_installed():
 | 
				
			||||||
            # Check if user import ipex manually
 | 
					            # Check if user import ipex manually
 | 
				
			||||||
            if 'ipex' in sys.modules or 'intel_extension_for_pytorch' in sys.modules:
 | 
					            if BIGDL_CHECK_DUPLICATE_IMPORT:
 | 
				
			||||||
                log4Error.invalidInputError(False,
 | 
					                if 'ipex' in sys.modules or 'intel_extension_for_pytorch' in sys.modules:
 | 
				
			||||||
                                            ipex_duplicate_import_error)
 | 
					                    log4Error.invalidInputError(False,
 | 
				
			||||||
 | 
					                                                ipex_duplicate_import_error)
 | 
				
			||||||
            self.directly_import_ipex()
 | 
					            self.directly_import_ipex()
 | 
				
			||||||
            self.ipex_version = ipex.__version__
 | 
					            self.ipex_version = ipex.__version__
 | 
				
			||||||
            # Replace builtin import to avoid duplicate ipex import
 | 
					            # Replace builtin import to avoid duplicate ipex import
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue