Getting error while implementing Falcon-7B model: AttributeError: module 'signal' has no attribute 'SIGALRM'
Author: amitkedia007
Pull request: no

### System Info

![Screenshot 2023-07-31 134702](https://github.com/huggingface/transformers/assets/83700281/7282ae2e-ca4f-4d87-9968-57b00fdae1f0)


### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

from transformers import AutoTokenizer, pipeline

# Load the tokenizer
model_name = "tiiuae/falcon-7b"
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Create a text generation pipeline
text_generator = pipeline("text-generation", model=model_name, tokenizer=tokenizer)

# Generate text
input_text = "Hello! How are you?"
output = text_generator(input_text, max_length=100, do_sample=True)
generated_text = output[0]["generated_text"]

# Print the generated text
print(generated_text)

### Expected behavior

It should get the text generated by the model. But it was showing me this error:
"Traceback (most recent call last):
  File "C:\DissData\Dissertation-Brunel\Falcon-7b.py", line 8, in <module>
    text_generator = pipeline("text-generation", model=model_name, tokenizer=tokenizer)
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\pipelines\__init__.py", line 705, in pipeline
    config = AutoConfig.from_pretrained(model, _from_pipeline=task, **hub_kwargs, **model_kwargs)
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\models\auto\configuration_auto.py", line 986, in from_pretrained
    trust_remote_code = resolve_trust_remote_code(
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\dynamic_module_utils.py", line 535, in resolve_trust_remote_code
    signal.signal(signal.SIGALRM, _raise_timeout_error)
AttributeError: module 'signal' has no attribute 'SIGALRM'"

Is it possible to resolve this error as soon as possible?

Comments:
Hey @amitkedia007 ! I'm suspecting you are using Windows? Have you tried [this](https://huggingface.co/tiiuae/falcon-7b-instruct/discussions/57)?

Maybe adding `trust_remote_code = True` to `tokenizer = AutoTokenizer.from_pretrained(model_name)` in order to allow downloading the appropriate tokenizer would work. 
Please let me know if this works. Trying to help you fast here :)

Yes I tried this as well, as you said. But still I am getting the same error: 
Traceback (most recent call last):
  File "C:\DissData\Dissertation-Brunel\Falcon-7b.py", line 8, in <module>
    text_generator = pipeline("text-generation", model=model_name, tokenizer=tokenizer)
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\pipelines\__init__.py", line 705, in pipeline
    config = AutoConfig.from_pretrained(model, _from_pipeline=task, **hub_kwargs, **model_kwargs)
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\models\auto\configuration_auto.py", line 986, in from_pretrained
    trust_remote_code = resolve_trust_remote_code(
  File "C:\Users\2267302\AppData\Roaming\Python\Python39\site-packages\transformers\dynamic_module_utils.py", line 535, in resolve_trust_remote_code
    signal.signal(signal.SIGALRM, _raise_timeout_error)
AttributeError: module 'signal' has no attribute 'SIGALRM'

I'm going through the code, and I'm finding dynamic_module_utils.py [verbose trace](https://github.com/huggingface/transformers/blob/main/src/transformers/dynamic_module_utils.py#L556C47-L556C47) at 556 instead of 535 . Have a look at the [function as well](https://github.com/huggingface/transformers/blob/9ca3aa01564bb81e1362288a8fdf5ac6e0e63126/src/transformers/dynamic_module_utils.py#L550)
Which version of the transformers library are you using?

See #25049, but basically

> "Loading this model requires you to execute execute some code in that repo on your local machine. "
> "Make sure you have read the code at https://hf.co/{model_name} to avoid malicious use, then set "
> "the option `trust_remote_code=True` to remove this error."

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.