noamaanMulla-03/transformers-issues huggingface dataset:
How to download files from HF spaces
Author: andysingal
Pull request: no

### System Info

google colab 

### Who can help?

@sanchit-gandhi @rock

### 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

i tried:
```
from huggingface_hub import hf_hub_download,hf_hub_url
# model_path  = hf_hub_download(repo_id="xinyu1205/recognize-anything", filename="tag2text_swin_14m.pth",  local_dir = "/content")
```
but throws an error repo not present


### Expected behavior

download the file

Comments:
Hi @andysingal, 

There is a typo in the repo_id. The correct command is: 

```
model_path  = hf_hub_download(repo_id="xinyu1205/recognize_anything_model", filename="tag2text_swin_14m.pth",  local_dir = "/content")
```

If you receive an error that a repo doesn't exist, the best thing to do is check directly on the hub for the repo and file name. 

The file exists in the space

On Thu, Aug 3, 2023 at 15:41 amyeroberts ***@***.***> wrote:

> Hi @andysingal <https://github.com/andysingal>,
>
> There is a typo in the repo_id. The correct command is:
>
> model_path  = hf_hub_download(repo_id="xinyu1205/recognize_anything_model", filename="tag2text_swin_14m.pth",  local_dir = "/content")
>
> If you receive an error that a repo doesn't exist, the best thing to do is
> check directly on the hub for the repo and file name.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/transformers/issues/25280#issuecomment-1663711815>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AE4LJNPJ7VV53GDNHXAUTCLXTN2N7ANCNFSM6AAAAAA3CJWHSU>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>


If downloading from the space, then you should specify the repo type in the `hf_hub_download` command

```
model_path  = hf_hub_download(repo_id="xinyu1205/recognize-anything", filename="tag2text_swin_14m.pth",  local_dir = "/content", repo_type="space")
```

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.
[Question] How to load AutoFeatureExtractor on GPU?
Author: treya-lin
Pull request: no

Hi, I am following this guide to learn how to do audio classification with wav2vec2: https://huggingface.co/docs/transformers/main/tasks/audio_classification

I intend to extract features of my data with the following codes
```
feature_extractor = AutoFeatureExtractor.from_pretrained("/workspace/models/wav2vec2-large-robust")

def preprocess_function(examples):
    audio_arrays = [x["array"] for x in tqdm(examples["audio"])]
    inputs = feature_extractor(
        audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
    )
    return inputs

encoded_audio_dataset_train = audio_dataset_train.map(preprocess_function, remove_columns="audio", batched=True)
```
But it seems the extractor is loaded to CPU instead of GPU, and I didn't find in documentation how to set the device for loading feature extractor. I assume the feature extraction is done by the wav2vec2 model itself right? If so how to do this on GPU? Or is it mentioned in any documentation that I didn't notice? 

This is my first time to use transformers library in audio processing so please forgive my clumsiness. 

Any help is much appreciated.

Comments:
Hi @treya-lin, thanks for raising an issue! 

This is a question best placed in our [forums](https://discuss.huggingface.co/). We try to reserve the github issues for feature requests and bug reports.

You can move arrays prepared by the feature extractor to the GPU using the `to` method on its outputs: 

```
def preprocess_function(examples):
    audio_arrays = [x["array"] for x in tqdm(examples["audio"])]
    inputs = feature_extractor(
        audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
    ).to("cuda")
    return inputs
``` 

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.
Why I cannot assign new parameter to the whisper pretrained config?
Author: teinhonglo
Pull request: no

### System Info

- `transformers` version: 4.31.0
- Platform: Linux-5.4.0-155-generic-x86_64-with-glibc2.31
- Python version: 3.10.11
- Huggingface_hub version: 0.16.4
- Safetensors version: 0.3.1
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.0.1+cu118 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

Why can I not assign a new parameter to the whisper pretrained config?

Note that the parameter "final_dropout" is not in a config of the "openai/whisper-small".

I used the code piece as following:
```
from transformers import AutoConfig, WhisperModel
config = AutoConfig.from_pretrained("openai/whisper-small", final_dropout=0.1)
config.final_dropout
```

The error is shown below:
```
AttributeError: 'WhisperConfig' object has no attribute 'final_dropout'
```

### Expected behavior

config.final_dropout=0.1


Any guidance would be appreciated.
Tien-Hong

Comments:
Hi @teinhonglo, thanks for raising this issue! 

The reason for not being able to assign through the `from_pretrained` call is a safety check. Unknown kwargs are not applied: their application is ambigious - should they control the `from_pretrained` behaviour or be set as a config attribute? You can see which kwargs weren't set using `return_unused_kwargs` argument c.f. [here](https://huggingface.co/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained.return_unused_kwargs) and [here](https://huggingface.co/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained.kwargs) in the docs.

After loading in the config, you can set attributes e.g.:
```
from transformers import AutoConfig, WhisperModel
config = AutoConfig.from_pretrained("openai/whisper-small")
config.final_dropout = 0.1
```


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.
how to print out the data loaded by each epoch during trainer.train() training?
Author: ahong007007
Pull request: no

### Feature request

please tell to me,
 how to print out the data loaded by each epoch during trainer.train() training?

### Motivation

 how to print out the data loaded by each epoch during trainer.train() training?

### Your contribution

 how to print out the data loaded by each epoch during trainer.train() training?

Comments:
Hi @ahong007007, thanks for raising an issue! 

This is a question best placed in our [forums](https://discuss.huggingface.co/). We try to reserve the github issues for feature requests and bug reports.

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.
fix bad URL to Llama 2
Author: fangli80
Pull request: yes

# What does this PR do?


## Before submitting
-  [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).



Comments:
@fangli80 Running`make fix-copies` and pushing the changes will resolve the failing quality CI checks

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.
replace `per_gpu_eval_batch_size` with `per_device_eval_batch_size` in readme of multiple-choice task
Author: ji-huazhong
Pull request: yes

### What does this PR do?
replace `per_gpu_eval_batch_size` with `per_device_eval_batch_size` in readme of multiple-choice task as the training arguments `per_gpu_*` is deprecated.




## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.



Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_25078). All of your documentation changes will be reflected on that endpoint.
BART Impelemntation in JAX vs Pytorch
Author: DavidAkinpelu
Pull request: no

It is possible to initiate BART decoder as a less causal decoder based in Jax implementation and but It doesn't seems straight forward in Pytorch?

I there any reason why this is designed this way?

Comments:
Hi @DavidAkinpelu, thanks for raising an issue! 

This is a question best placed in our [forums](https://discuss.huggingface.co/). We try to reserve the github issues for feature requests and bug reports.

Okay.
AutoModel.from_pretrained is messing with stack traces in jupyter
Author: qrdlgit
Pull request: no

### System Info

AutoModel.from_pretrained is messing with stack traces 

I get these wacky stack traces displayed for unhandled exceptions after running AutoModel.from_pretrained("BAAI/bge-small-en").   Colored text, etc.  Do. Not.  Want.

Worse - these stack traces are missing relevant frames which make it impossible to debug.

How do I get rid of this / stop this from happening?

I tried resetting the sys.excepthook, but it didn't help

Took me way too long to find the culprit.  At first I thought it was sentence transformers, than I went through every dep / and line by line code.   These sorts of insane bundling side effect nonsense things which permanently mess with your environment beyond the lifetime of the process have to stop.


### 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

AutoModel.from_pretrained("BAAI/bge-smal-en").

### Expected behavior

Certainly not that.

Comments:
Hi @qrdlgit, thanks for opening an issue!

Would it be possible to share an example of the trackback itself and what it looks like? Just from this description it's not possible to know what the issue is. For example, what relevant frames are missing or what is considered to be 'wacky'.

This has been fixed in latest issue by making rich opt-in  https://github.com/huggingface/accelerate/issues/1630
TF-OPT attention mask fixes
Author: Rocketknight1
Pull request: yes

With apologies for the delay, this PR should hopefully resolve the issues in #24637. @abb128 can you please try installing from this PR and verify if it resolves your issues? You can install from this PR with:

`pip install --upgrade git+https://github.com/huggingface/transformers.git@tf_opt_fixes`

Fixes #24637

Comments:
_The documentation is not available anymore as the PR was closed or merged._

No response, but we should probably merge anyway. Pinging @amyeroberts for core maintainer review!

@amyeroberts Sorry for the delay, I lost track of this one!
[`VITS`]  tokenizer integration test: fix revision did not exist
Author: ArthurZucker
Pull request: yes

# What does this PR do?
Fixes the revisiono f the integration test for the VITs tokenizer.
`RUN_SLOW=1 pytest tests/models/vits/test_tokenization_vits.py `  on main outputs:
```python 
E           OSError: Can't load tokenizer for 'facebook/mms-tts-eng'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'facebook/mms-tts-eng' is the correct path to a directory containing all relevant files for a VitsTokenizer tokenizer.

src/transformers/tokenization_utils_base.py:1893: OSError
```
because the revision does not exist

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Save tokenizer and model config when training with FSDP
Author: J38
Pull request: yes

# What does this PR do?

Currently when training models with FSDP the tokenizer and model config are not saved (at least using standard configs I have). This is especially bad when running a custom train.py that modifies the tokenizer and model before training. In that scenario there is no record of the new model config or tokenizer.

I have altered trainer.py to have a `_save_tokenizer_and_configs` method and added a call to this method in the model saving logic when FSDP is enabled.

If the team feels there could be better refactoring to handle this would be happy to discuss improvements to this PR!

Other note, to the best of my knowledge this is happening because when the logic flows to FSDP enabled it is just using the custom FSDP model saving and there is no logic for saving the other tokenizer and config info. If there is already a known config setting I'm missing that would fix this please let me know.

## Before submitting

I have not added any new tests.

## Who can review?

This involves modifications to the trainer so maybe @sgugger would be interested in reviewing?


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_25198). All of your documentation changes will be reflected on that endpoint.

@sgugger @pacman100 is there anything else you'd like me to do for this PR?

@pacman100 friendly ping here.

Hello, this PR #https://github.com/huggingface/transformers/pull/24926 should resolve the issue mentioned in this PR. Could you try with the latest main branch and let us know if the issue still remains

Okay I will investigate and let you know!

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.
docs: update link huggingface map
Author: pphuc25
Pull request: yes

Hi,
I have discovered that the link to the dataset mapping documentation is no longer up to date. Therefore, I have updated the link to the current version, which can be found here: https://huggingface.co/docs/datasets/process#map
I would like to cc @stevhliu for review my code.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26077). All of your documentation changes will be reflected on that endpoint.
Punctuation fix
Author: kwonmha
Pull request: yes

# What does this PR do?

Add maybe missing punctuation which enables to ends sentence and starts a new sentence.


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26025). All of your documentation changes will be reflected on that endpoint.
docs: add space to docs
Author: pphuc25
Pull request: yes

Hi,
In many code this seem that there no space in doc, so I add space to make this look better.
I would like to cc @amyeroberts to review my code.
thank you so much for reading my PR.


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26067). All of your documentation changes will be reflected on that endpoint.
only main process should call _save on deepspeed zero3
Author: zjjMaiMai
Pull request: yes

# Background

`trainer._save` call on all process after https://github.com/huggingface/transformers/pull/25817. will raise `FileExistsError` when model save.

# What does this PR do?

this pr fix it, `trainer._save` will call on main process only.

Comments:
cc @muellerzr @pacman100 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_25959). All of your documentation changes will be reflected on that endpoint.

@pacman100 any things i need to do?

@zjjMaiMai One of the hub tests are failing, complaining that the base_model is empty when pushing to the hub. Could you try running this test locally to see whether it's a result of the changes in this PR?

> @zjjMaiMai One of the hub tests are failing, complaining that the base_model is empty when pushing to the hub. Could you try running this test locally to see whether it's a result of the changes in this PR?

```
$ pytest tests/trainer/test_trainer.py -k 'test_push_to_hub'
================================================================================================================================ test session starts ================================================================================================================================
platform linux -- Python 3.9.2, pytest-7.4.1, pluggy-1.3.0
configfile: setup.cfg
plugins: timeout-2.1.0, hypothesis-6.84.2, dash-2.13.0, xdist-3.3.1, anyio-3.7.1
collected 95 items / 91 deselected / 4 selected                                                                                                                                                                                                                                     

tests/trainer/test_trainer.py ssss                                                                                                                                                                                                                                            [100%]

================================================================================================================================= warnings summary ==================================================================================================================================
../../../../../../home/.local/lib/python3.9/site-packages/_pytest/config/__init__.py:1376
  /home/.local/lib/python3.9/site-packages/_pytest/config/__init__.py:1376: PytestConfigWarning: Unknown config option: doctest_glob
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================================================== 4 skipped, 91 deselected, 1 warning in 1.69s ====================================================================================================================
$ git branch 
* fix_save_deepspeed_3
  main
```

@zjjMaiMai Could you try and rebase on main? This should resolve the failing tests. 

All green! @amyeroberts
🌐 [i18n-KO] Translated `llama.md` to Korean
Author: harheem
Pull request: yes

# What does this PR do?

Translated the `llama.md` file of the documentation to Korean 😄 
Thank you in advance for your review!

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [ ] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?

## Who can review? (Final)


Comments:
Hello, @stevhliu 👋
Should we translate the `autodoc` part in model_doc too?

> 모델 문서 번역에 참여해주셔서 감사합니다! 좋은 번역이에요 😆
> 일부 문장에 새로운 제안을 드렸습니다. 검토 부탁드려요!

리뷰 감사합니다! 코멘트 달아주신 것들이 전부 고민했던 부분이었는데, 좋은 표현 찾아주셔서 감사해요 🤩

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26044). All of your documentation changes will be reflected on that endpoint.
Fix vilt config docstring parameter to match value in init
Author: raghavanone
Pull request: yes

# What does this PR do?

Fixes #25639 

This PR fixes the Vilt models config's init parameters to match the ones in the documentation.

Comments:
> Thanks for opening this PR! The fix should go the other way: the documentation is updated to reflect the default values

Oh Yes, Got misled by the discussion [here](https://github.com/huggingface/transformers/issues/25639) . But checked [here](https://huggingface.co/dandelin/vilt-b32-mlm/blob/main/config.json) , the init is right, only the documentation needs to be changed .

@amyeroberts  Done.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26017). All of your documentation changes will be reflected on that endpoint.