File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed 
src/diffusers/quantizers/torchao Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change 3535    import  torch 
3636    import  torch .nn  as  nn 
3737
38+     SUPPORTED_TORCH_DTYPES_FOR_QUANTIZATION  =  (
39+         # At the moment, only int8 is supported for integer quantization dtypes. 
40+         # In Torch 2.6, int1-int7 will be introduced, so this can be visited in the future 
41+         # to support more quantization methods, such as intx_weight_only. 
42+         torch .int8 ,
43+         torch .float8_e4m3fn ,
44+         torch .float8_e5m2 ,
45+         torch .uint1 ,
46+         torch .uint2 ,
47+         torch .uint3 ,
48+         torch .uint4 ,
49+         torch .uint5 ,
50+         torch .uint6 ,
51+         torch .uint7 ,
52+     )
53+ 
3854if  is_torchao_available ():
3955    from  torchao .quantization  import  quantize_ 
4056
4157
4258logger  =  logging .get_logger (__name__ )
4359
44- SUPPORTED_TORCH_DTYPES_FOR_QUANTIZATION  =  (
45-     # At the moment, only int8 is supported for integer quantization dtypes. 
46-     # In Torch 2.6, int1-int7 will be introduced, so this can be visited in the future 
47-     # to support more quantization methods, such as intx_weight_only. 
48-     torch .int8 ,
49-     torch .float8_e4m3fn ,
50-     torch .float8_e5m2 ,
51-     torch .uint1 ,
52-     torch .uint2 ,
53-     torch .uint3 ,
54-     torch .uint4 ,
55-     torch .uint5 ,
56-     torch .uint6 ,
57-     torch .uint7 ,
58- )
59- 
6060
6161def  _quantization_type (weight ):
6262    from  torchao .dtypes  import  AffineQuantizedTensor 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments