diff --git a/modeling/bagel/qwen2_navit.py b/modeling/bagel/qwen2_navit.py index cdbc7570..505afb8b 100644 --- a/modeling/bagel/qwen2_navit.py +++ b/modeling/bagel/qwen2_navit.py @@ -772,7 +772,7 @@ def forward_inference( enable_taylorseer = getattr(self, 'enable_taylorseer', False) - if enable_taylorseer and self.current['type'] == 'full': + if enable_taylorseer and self.current['type'] == 'full' and self.current['layer'] == 27: self.current['module'] = 'total' taylor_cache_init(cache_dic=self.cache_dic, current=self.current) @@ -821,7 +821,7 @@ def forward_inference( packed_query_sequence = residual + packed_query_sequence - if enable_taylorseer: + if enable_taylorseer and self.current['layer'] == 27: if self.current['type'] == 'full': derivative_approximation(cache_dic=self.cache_dic, current=self.current, feature=packed_query_sequence) elif self.current['type'] == 'Taylor':