Skip to content

Commit

Permalink
fix for auto_map check when using remote code and multipack for model…
Browse files Browse the repository at this point in the history
…s like deepseek (#2151) [skip ci]
  • Loading branch information
winglian authored Dec 8, 2024
1 parent 440aab8 commit 2231918
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,14 @@ def apply_patches(self) -> None:
and self.cfg.flash_attention
and self.cfg.sample_packing
):
has_remote_code = (
"auto_map" in self.model_config
and "AutoModelForCausalLM" in self.model_config["auto_map"]
)
if "auto_map" in self.model_config:
try:
auto_map_config = self.model_config["auto_map"]
except TypeError:
auto_map_config = self.model_config.auto_map
has_remote_code = "AutoModelForCausalLM" in auto_map_config
else:
has_remote_code = False
if has_remote_code and self.cfg.trust_remote_code is False:
# if explicitly set in the YAML, we should prefer that, for example if explicitly disabled
has_remote_code = self.cfg.trust_remote_code
Expand Down

0 comments on commit 2231918

Please sign in to comment.