@@ -73,7 +73,7 @@ def __init__(self, model: nn.Module, **kwargs) -> None:
73
73
):
74
74
raise AssertionError ("Please use `from_pretrained` method to load quantized models" )
75
75
76
- super ().__init__ (model )
76
+ super ().__init__ (model , ** kwargs )
77
77
78
78
def __repr__ (self ) -> str :
79
79
return self .__class__ .__name__ + "\n " + self .model .__repr__ ()
@@ -174,7 +174,7 @@ def __init__(self, model: nn.Module, pooling=None, **kwargs):
174
174
self .model , _ = PoolingTransform .apply (self .model , pooling )
175
175
176
176
self .model .base_model .config .use_cache = True
177
- self .model_params ["qeff_class" ] = self .__class__ .__name__
177
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
178
178
179
179
@classmethod
180
180
@with_replaced_quantizers
@@ -435,7 +435,7 @@ class QEffVisionEncoderForTextImageToTextModel(QEFFBaseModel):
435
435
def __init__ (self , model : nn .modules , ** kwargs ):
436
436
super ().__init__ (model , ** kwargs )
437
437
self .model = model .get_qeff_vision_encoder ()
438
- self .model_params ["qeff_class" ] = self .__class__ .__name__
438
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
439
439
440
440
def export (self , inputs , output_names , dynamic_axes , export_dir = None ):
441
441
return self ._export (inputs , output_names , dynamic_axes , export_dir )
@@ -490,7 +490,7 @@ class QEffCausalLMForTextImageToTextModel(QEFFBaseModel):
490
490
def __init__ (self , model , ** kwargs ):
491
491
super ().__init__ (model , ** kwargs )
492
492
self .model = model .get_qeff_language_decoder ()
493
- self .model_params ["qeff_class" ] = self .__class__ .__name__
493
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
494
494
495
495
def export (self , inputs , output_names , dynamic_axes , export_dir = None ):
496
496
return self ._export (inputs , output_names , dynamic_axes , export_dir )
@@ -543,8 +543,8 @@ def __init__(
543
543
raise NotImplementedError ("Continuous batching is not supported for image-text-to-text models yet." )
544
544
self .model = model
545
545
self .config = model .config
546
- self .vision_model = QEffVisionEncoderForTextImageToTextModel (model )
547
- self .lang_model = QEffCausalLMForTextImageToTextModel (model )
546
+ self .vision_model = QEffVisionEncoderForTextImageToTextModel (model , ** kwargs )
547
+ self .lang_model = QEffCausalLMForTextImageToTextModel (model , ** kwargs )
548
548
self .input_shapes , self .output_names = None , None
549
549
550
550
@property
@@ -916,7 +916,7 @@ def __init__(
916
916
self .model .config .vision_config .use_flash_attn = "false"
917
917
else :
918
918
self .model .config .text_config .use_cache = True
919
- self .model_params ["qeff_class" ] = self .__class__ .__name__
919
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
920
920
921
921
@classmethod
922
922
def from_pretrained (
@@ -940,10 +940,6 @@ def from_pretrained(
940
940
model = cls ._hf_auto_class .from_pretrained (pretrained_model_name_or_path , config , * args , ** kwargs )
941
941
942
942
return cls (model , pretrained_model_name_or_path = pretrained_model_name_or_path , ** kwargs )
943
- # # Bypass __call__ and manually initialize
944
- # instance = object.__new__(cls)
945
- # instance.__init__(model, pretrained_model_name_or_path=pretrained_model_name_or_path, **kwargs)
946
- # return instance
947
943
948
944
def export (
949
945
self ,
@@ -1288,11 +1284,6 @@ def from_pretrained(cls, pretrained_model_name_or_path: str, kv_offload: Optiona
1288
1284
model = cls ._hf_auto_class .from_pretrained (pretrained_model_name_or_path , ** kwargs )
1289
1285
return cls (model , kv_offload = kv_offload , pretrained_model_name_or_path = pretrained_model_name_or_path , ** kwargs )
1290
1286
1291
- # # Bypass __call__ and manually initialize
1292
- # instance = object.__new__(cls)
1293
- # instance.__init__(model, kv_offload=kv_offload, pretrained_model_name_or_path=pretrained_model_name_or_path, **kwargs)
1294
- # return instance
1295
-
1296
1287
1297
1288
MISCLASSIFIED_CAUSAL_LM_TO_QEFF_AUTO_CLASS_MAP = {"InternVLChatModel" : QEFFAutoModelForImageTextToText }
1298
1289
@@ -1376,7 +1367,11 @@ def __init__(
1376
1367
self .pretrained_model_name_or_path = kwargs .get ("pretrained_model_name_or_path" , None )
1377
1368
self .model , transformed = SpDTransform .apply (self .model , qaic_config , ** kwargs )
1378
1369
self .is_tlm = transformed
1370
+ < << << << HEAD
1379
1371
1372
+ == == == =
1373
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
1374
+ >> >> >> > dd35ad1 (Modifications to the flow of hash creation and filtration of params for export )
1380
1375
# ---Sampling---
1381
1376
# Note: SamplerTransform should be applied after all other transforms
1382
1377
# are done. The role of the sampler is to just add nodes at the output of the
@@ -1917,7 +1912,7 @@ def __init__(self, model: nn.Module, **kwargs):
1917
1912
super ().__init__ (model , ** kwargs )
1918
1913
self .model .config .use_cache = True
1919
1914
self .num_layers = model .config .num_hidden_layers
1920
- self .model_params ["qeff_class" ] = self .__class__ .__name__
1915
+ self .hash_params ["qeff_class" ] = self .__class__ .__name__
1921
1916
1922
1917
@property
1923
1918
def get_model_config (self ) -> dict :
0 commit comments