Ignore all exceptions from signal in dynamic code (#25623)

This commit is contained in:
Sylvain Gugger 2023-08-21 09:01:11 +02:00 committed by GitHub
parent 1982dd3b15
commit f92cc7034a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -603,7 +603,7 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has
elif answer.lower() in ["no", "n", "0", ""]:
trust_remote_code = False
signal.alarm(0)
except AttributeError:
except Exception:
# OS which does not support signal.SIGALRM
raise ValueError(
"Loading this model requires you to execute execute some code in that repo on your local machine. "