Risks of Remote Code Execution.

#22
by MeanBean-05 - opened

Hi. Can anyone tell me the risks of using the param "trust_remote_code=True".

Hello!

If you set trust_remote_code to True, then you agree to "trust" the code from this repository. Notably, the code in modeling.py and configuration.py. This code is not authored by the transformers or sentence_transformers maintainers themselves, so for security purposes you have to set trust_remote_code=True to run this "remote" code.

I didn't write any of the code in this repository, but I did look it over. As far as I can tell, it looks proper/normal. I use this model without worries.

If it makes you feel a bit better, then you can also download the repository and load that local model instead. Then you know that the modeling code won't be unexpectedly changed one day. I believe you can also set revision=2aa5579fcae1c579de199a3866b6e514bbbf5d10 (a.k.a. the last commit) when loading the model and then you'll always get the model at this version, rather than any unexpected updates.

  • Tom Aarsen

@tomaarsen How do I run this model locally with trust_remote_code=False?

@kRYLLEBYLLE . I guess you can't run it with trust_remote_code=False. To do that you have to download the model to your local device. Just paste your local model folder path while loading the model. It would be like using your own model Just make sure that you go through the modeling.py and configuration.py files. They've been updated since I've last checked i guess.
@tomaarsen has personally gone through the modeling.py file and has ensured nothing malicious is present back then. So i used it back then

Sign up or log in to comment