infinity icon indicating copy to clipboard operation
infinity copied to clipboard

Add revision and trust_remote_code to from_pretrained calls

Open chiragjn opened this issue 1 year ago • 1 comments

I was trying out Snowflake/snowflake-arctic-embed-m-long with onnx engine

infinity_emb --model-name-or-path Snowflake/snowflake-arctic-embed-m-long --revision 08e7a4449e3f07709fb9387bc3172d393a6cc5e2 --engine optimum --device cpu --dtype float32 --batch-size 4 --port 8000 --trust-remote-code 

But trust_remote_code is not being passed along

  File "/app/infinity_emb/transformer/embedder/optimum.py", line 51, in __init__
    self.model = optimize_model(
  File "/app/infinity_emb/transformer/utils_optimum.py", line 107, in optimize_model
    unoptimized_model_path = model_class.from_pretrained(
  File "/app/.venv/lib/python3.10/site-packages/optimum/onnxruntime/modeling_ort.py", line 669, in from_pretrained
    return super().from_pretrained(
  File "/app/.venv/lib/python3.10/site-packages/optimum/modeling_base.py", line 373, in from_pretrained
    config = cls._load_config(
  File "/app/.venv/lib/python3.10/site-packages/optimum/modeling_base.py", line 231, in _load_config
    config = AutoConfig.from_pretrained(
  File "/app/.venv/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1141, in from_pretrained
    trust_remote_code = resolve_trust_remote_code(
  File "/app/.venv/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 622, in resolve_trust_remote_code
    raise ValueError(
ValueError: Loading Snowflake/snowflake-arctic-embed-m-long requires you to execute the configuration file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option `trust_remote_code=True` to remove this error.

chiragjn avatar May 17 '24 11:05 chiragjn

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 74.27%. Comparing base (8d78747) to head (98fb360). Report is 2 commits behind head on main.

Files Patch % Lines
...ty_emb/infinity_emb/transformer/embedder/neuron.py 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
- Coverage   74.37%   74.27%   -0.11%     
==========================================
  Files          32       32              
  Lines        1889     1889              
==========================================
- Hits         1405     1403       -2     
- Misses        484      486       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 17 '24 16:05 codecov-commenter

Thanks for your contribution!

michaelfeil avatar May 19 '24 05:05 michaelfeil