File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed 
modelopt/torch/quantization Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1616"""Quantization conversion/restore utilities.""" 
1717
1818import  fnmatch 
19+ import  warnings 
1920from  collections .abc  import  Callable 
2021from  contextlib  import  contextmanager 
2122from  typing  import  Any 
@@ -288,11 +289,15 @@ def set_quantizer_attribute(
288289            ):
289290                continue 
290291
291-             if  isinstance (attribute , list ):
292+             if  isinstance (attribute , list )  and   not   isinstance ( module ,  SequentialQuantizer ) :
292293                parent_module  =  quant_model .get_submodule (name .rpartition ("." )[0 ])
293294                module  =  SequentialQuantizer (* (TensorQuantizer () for  _  in  range (len (attribute ))))
294295                setattr (parent_module , name .split ("." )[- 1 ], module )
295- 
296+             elif  isinstance (attribute , list ) and  len (attribute ) !=  len (module ):
297+                 warnings .warn (
298+                     f"The number of attributes ({ len (attribute )}  ) does not match the number of " 
299+                     f"quantizers of { module }   leading to partial assignment." ,
300+                 )
296301            module .set_from_attribute_config (attribute )
297302
298303
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments