From 8e564a045c00054d1675265d37ccd15834a33a4c Mon Sep 17 00:00:00 2001 From: GoshaSerbin Date: Thu, 23 Jul 2026 09:35:55 +0300 Subject: [PATCH] fix(caching): avoid redundant computations during caching --- modeling/bagel/qwen2_navit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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':