Skip to content

Commit

Permalink
[Bugfix] Raise error for processor remote code (#1184)
Browse files Browse the repository at this point in the history
## Purpose ##
* Raise error when processor cannot load due to required remote code
option

Signed-off-by: Kyle Sayers <[email protected]>
  • Loading branch information
kylesayrs authored Mar 12, 2025
1 parent f19fdd0 commit 23bde49
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/llmcompressor/entrypoints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,16 @@ def initialize_processor_from_path(
use_auth_token=True if model_args.use_auth_token else None,
trust_remote_code=model_args.trust_remote_code_model,
)
except Exception:

except ValueError as exception:
if "trust_remote_code=True" in exception.value:
raise ValueError(
f"The repository for {processor_src} contains custom code which must "
"be executed to correctly load the tokenizer/processor. You can "
f"inspect the repository content at https://hf.co/{processor_src}.\n"
"Please pass the argument `trust_remote_code_model=True`."
)

logger.debug("Could not load fast processor, loading slow processor instead")
processor = AutoProcessor.from_pretrained(
processor_src,
Expand Down

0 comments on commit 23bde49

Please sign in to comment.