[Bugfix] Skip fetching revision for model when model and weights_model are different (#51260)

Signed-off-by: Dino Music <Dino.Music@amd.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
music-dino
2026-08-07 12:55:50 +00:00
committed by GitHub
co-authored by Harry Mellor
parent d5aae2b464
commit a231c5ceac
2 changed files with 27 additions and 7 deletions
+5 -3
View File
@@ -567,9 +567,11 @@ class ModelConfig:
# If loading model/tokenizer from HF Hub, resolve the revision once
# to prevent resolving it multiple times downstream.
can_resolve_model_revision = (
self.hf_config_path is None or self.hf_config_path == self.model
)
# If the weights come from a different repo, we cannot eagerly resolve revision
weights_from_model = not self.model_weights or self.model_weights == self.model
# If the config comes from a different repo, we cannot eagerly resolve revision
config_from_model = not self.hf_config_path or self.hf_config_path == self.model
can_resolve_model_revision = config_from_model and weights_from_model
if can_resolve_model_revision:
self.revision = resolve_revision(
self.model,