-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to reset the signal handler for ALARM after we call resolve_trust_remote_code
#29690
Comments
The alarm should clear in a
The alarm will not be clean, so the alarm will be triggered in the future, and it will produce very confuse error. |
Will have a look thanks for reporting. Could you share the reproducer as well? 🤗 |
This happened after I load a tokenizer and without import time
from transformers import AutoTokenizer
from transformers.dynamic_module_utils import TIME_OUT_REMOTE_CODE
hf_tokenizer_name = 'THUDM/chatglm2-6b'
try:
AutoTokenizer.from_pretrained(hf_tokenizer_name, use_fast=True)
except ValueError:
print("STDIN has closed")
print("Now the program continues")
time.sleep(TIME_OUT_REMOTE_CODE + 5) We can save this script to a file: python test.py 0<&- The output:
|
System Info
transformers==4.38.1
python==3.9
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Hi, we've met an interesting error while we're using the version
4.38.1
, here's the part of the tracebackAs I checked the code which it was introduced in this commit, I see we've register a signal handler for ALARM to raise an exception when we encounter the timeout case(see https://github.com/huggingface/transformers/blob/v4.38.1/src/transformers/dynamic_module_utils.py#L595-L596). And we didn't reset the signal handler to the default after the function is ended.
Expected behavior
The signal handler shouldn't affect to other part of a system.
The text was updated successfully, but these errors were encountered: