File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed 
tests/quantization/quanto Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 66from  diffusers .models .attention_processor  import  Attention 
77from  diffusers .utils  import  is_optimum_quanto_available , is_torch_available 
88from  diffusers .utils .testing_utils  import  (
9+     backend_reset_peak_memory_stats ,
10+     backend_empty_cache ,
911    enable_full_determinism ,
1012    nightly ,
1113    numpy_cosine_similarity_distance ,
@@ -41,17 +43,15 @@ class QuantoBaseTesterMixin:
4143    keep_in_fp32_module  =  "" 
4244    modules_to_not_convert  =  "" 
4345    _test_torch_compile  =  False 
44-     torch_accelerator_module  =  None 
4546
4647    def  setUp (self ):
47-         self .torch_accelerator_module  =  getattr (torch , torch_device , torch .cuda )
48-         self .torch_accelerator_module .reset_peak_memory_stats ()
49-         self .torch_accelerator_module .empty_cache ()
48+         backend_reset_peak_memory_stats (torch_device )
49+         backend_empty_cache (torch_device )
5050        gc .collect ()
5151
5252    def  tearDown (self ):
53-         self . torch_accelerator_module . reset_peak_memory_stats ( )
54-         self . torch_accelerator_module . empty_cache ( )
53+         backend_reset_peak_memory_stats ( torch_device )
54+         backend_empty_cache ( torch_device )
5555        gc .collect ()
5656
5757    def  get_dummy_init_kwargs (self ):
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments