noamaanMulla-03/transformers-issues huggingface dataset:
could set  max_length or max_seq_length bigger than 512 in NER?
Author: ucas010
Pull request: no

### System Info


- `transformers` version: 4.26.0.dev0
- Platform: Linux-3.10.0-1160.81.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.9.15
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.13.1+cu116 (True)
- Tensorflow version (GPU?): 2.6.0 (True)
- 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?

@sgugger 

### Information

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

### Tasks

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

### Reproduction

https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification
for fine-tune in NER
could I set --max_length or --max_seq_length bigger than 512 ??

  File "/data/python3.9/site-packages/transformers/models/bert/modeling_bert.py", line 237, in forward
    embeddings += position_embeddings
RuntimeError: The size of tensor a (2048) must match the size of tensor b (512) at non-singleton dimension 1


### Expected behavior

as I said before

Comments:
Please use the [forums](https://discuss.huggingface.co/) for such questions, as we keep issues for bugs and feature requests only.

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.
Respect documentation on passive log level
Author: sgugger
Pull request: yes

# What does this PR do?

The documentation states that setting a `log_level` to `"passive"` in the training arguments won't touch the log level, but this is not the case. Currently, setting `log_level` to `"passive"` is the same as setting it to `"info"`.
Likewise, setting `log_level_replica` to `"passive"` is the same as setting it to `"warning"`.

This PR fixes this and changes the default of `log_level_replica` to `"warning"` to have the same default for it. The question is whether we should change the default of `log_level` to `"info"` to have the same behavior as before, or leave it as is which would set it to warning unless the user has set their own Transformers verbosity to info like in the examples.

Related to #20154

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

while at it could you please remind me what does `passive` actually imply?

> a 'passive' level which doesn't set anything and lets the application set the level

how does the application set the level? which application? perhaps we need a small example?

Hmm, this broke many deepspeed tests that were relying on info log level in deepspeed.

now deepspeed is no longer logging info `"DeepSpeed info: version={}, git-hash={}, git-branch={}"`

and thus the tests fail as it is looking for this string to tell DS is running.

Now, why would this change impact an underlying component I wonder.

OK, I now have to explicitly pass ` log_level="info" to trainer args to have the previous functionality. This looks like a BC breakage, no?

I adapted `get_regression_trainer` to have the original behavior here: https://github.com/huggingface/transformers/pull/21769 so it's all back to working.

Yes, I did mention it changed the behavior in the description of the PR and asked for how to proceed. You and Lysandre both agreed the break was worth it in this case.

Totally, Sylvain. I guess I struggle to understand when a BC breakage is ok and when it's not.
Fix resume_from_checkpoint for deepspeed
Author: stas00
Pull request: yes

something is borked with CircleCI when a contributor has a CircleCI account that isn't set up to some requirements - we don't know what - so I re-created the PR from the original https://github.com/huggingface/transformers/pull/21735

------------------

This PR overcomes a possible issue with the using deepspeed resume when a non-deepspeed checkpoint file structure isn't there.

The original code comes from @mosheber and I had to apply a few more adjustments for tests to work after this change. The tests had to be run manually since they require gpus.

Credits to contributor's work have been correctly imported into this new PR.

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

ok, looks like we figured out the original so closing this one.
ImportError: cannot import name 'LayoutLMv3ForTokenClassification' from 'transformers' (unknown location)
Author: Harikishore-KA
Pull request: no

from transformers import LayoutLMv3ForTokenClassification

Unable to import LayoutLMv3 models

OS : Windows 10 
Python : Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  4 2021, 13:27:16) [MSC v.1928 64 bit (AMD64)] on win32
Package versions: transformers==4.26.0.dev0, torch==1.13.1

![image](https://user-images.githubusercontent.com/17734294/213330793-afe84196-9c6f-4484-aa9f-a631697a5bdf.png)


Comments:
Hi,

I'm not able to reproduce this error. It might make sense to uninstall and install transformers in a new, clean environment.

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 use Ipex via transformers
Author: Oxi84
Pull request: no

### Feature request

I saw you implemented Ipex. intel cpu optimisation but there is no any example how to use it via python. Only this example is available:

     python run_qa.py \
    --model_name_or_path csarron/bert-base-uncased-squad-v1 \
    --dataset_name squad \
    --do_eval \
    --max_seq_length 384 \
    --doc_stride 128 \
    --output_dir /tmp/ \
     --use_ipex \ 
     --jit_mode 

And this is not very useful for me as  I do interface via python script., not via command lines.

How would i use that here for example:

     from transformers import AutoTokenizer, AutoModel
     tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
     model = AutoModel.from_pretrained("bert-base-uncased")




### Motivation

documentation

### Your contribution

documentation

Comments:
Please use the [forums](https://discuss.huggingface.co/) for such question as we keep issues for bugs and feature requests only.

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.
Output of finetuned facebook/wav2vec2-xls-r-300m model is getting incorrect 
Author: Shubhambugade09
Pull request: no

### System Info

Transformers 4.23.1
Pytorch 1.12.1
Datasets 2.4.0
Tokenizers 0.13.2

I have finetuned  facebook/wav2vec2-xls-r-300m model on my own dataset. I have cross check my dataset twice is it correct format as like libri speech dataset.  I have finetuned my code using reference of @patrickvonplaten
https://huggingface.co/blog/fine-tune-wav2vec2-english

![image](https://user-images.githubusercontent.com/114153974/213086911-a50fab99-6e77-43c8-9320-baa81f23ecc4.png)



### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

a

### Expected behavior

In our case I am getting result like "THTMTHTET"  for IT IS PERMITTED TO TURN THE WHEELPAN BELOW MM WITH THE CONTROLS IN TABLE IT IS PERMITTED TO TURN BELOW THE LAST TURNING' GROOVE

this text we need 

Comments:
cc @sanchit-gandhi 

Hey @Shubhambugade09,

Could you please try provide a google colab that easily reproduces your training run or maybe instead use the forum specific fine-tuning questions: https://discuss.huggingface.co/ 

Thanks! 

Hey @patrickvonplaten

I have send you the jupyter notebook on [patrick.v.platen@gmail.com](mailto:patrick.v.platen@gmail.com). please check it 

Thanks! 

Hey @Shubhambugade09, would you mind posting a link to your Colab here so I can review it? It would be awesome to post the link here rather than sending as email so that the discussion remains public, this way helping other people who might be experiencing the same issue 🤗 Thanks!

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.
CodeGen Tokenizer Deletes Newline Symbols
Author: hellodanylo
Pull request: no

### System Info

- `transformers` version: 4.25.1
- Platform: Linux-5.15.0-58-generic-x86_64-with-glibc2.35
- Python version: 3.9.13
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): 1.12.1.post201 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): 0.6.3 (cpu)
- Jax version: 0.4.1
- JaxLib version: 0.4.1
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help?

@rooa @patrickvonplaten @patil-suraj

### Information

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

### Tasks

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

### Reproduction

The CodeGen tokenizer seems to remove the newline symbol in certain scenarios.
In particular, `decode(encode(text))` does not always equal the original `text`.
The following is the smallest example that reproduces the error but other text examples will have this issue as well.

```python
from transformers import CodeGenTokenizer

# other checkpoints in the CodeGen series have the same issue
tokenizer = CodeGenTokenizer.from_pretrained("Salesforce/codegen-350M-multi")

# new line (10), space (32), space (32)
text = "\n  "
print([ord(c) for c in text])
# output: [10, 32, 32]

encoded = tokenizer.encode(text)
print(encoded)
# output: [50286]

decoded = tokenizer.decode(encoded)
print([ord(c) for c in decoded])
# actual: [32, 32]
# expected: [10, 32, 32]
```

### Expected behavior

Expected: the decoded string is equal to the original string.
Actual: the decoded string is missing the leading new line symbol.

Comments:
Hi, @hellodanylo this looks like the same issue described in issue #21120, where the tokenizer strips the whitespace and \n in front and at the end of the sentence. To overcome it use `tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen-350M-multi")`.

cc @ArthurZucker 

@susnato thanks, using the fast tokenizer did solve this issue.

For future readers, you can get the fast tokenizer using either of the following ways:
```
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen-350M-multi")
tokenizer = CodeGenTokenizerFast.from_pretrained("Salesforce/codegen-350M-multi")
```

If this bug is not specific to CodeGen tokenizer, then we can close this as duplicate of #21120?

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.
Make `CLIPImageProcessor` compatible with `subfolder` kwarg 
Author: Abhinay1997
Pull request: no

### Feature request

The CLIPImageProcessor can't be initialized currently using:

```
CLIPImageProcessor.from_pretrained('kakaobrain/karlo-v1-alpha-image-variations', subfolder = 'feature_extractor', return_unused_kwargs=True)
```
as the `ImageProcessorMixin.get_image_processor_dict` method doesn't take in a `subfolder` kwarg to pass into `cached_file`

Link:
https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L214

Can we add the subfolder kwarg to be able to initialize a CLIPImageProcessor this way ?

### Motivation

Currently, other modules like the `CLIPTextModelWithProjection` are able to load from subfolders. It'd be nice to have CLIPImageProcessor also behave the same way.



### Your contribution

I'd be happy to open a PR on this. I was able to get it to work by passing `subfolder` directly to `cached_file` but need to verify a few more things.

Comments:
Thanks for flagging! We'll be happy to have a look at a PR!

@sgugger, I created the PR. #21725 

Closing the issue as PR is merged and issue is resolved. :)
Add SeaFormer model
Author: inderpreetsingh01
Pull request: no
Labels: name: New model

### Model description

The computational cost and memory requirement render many computer vision models unsuitable on the mobile device, especially for the high-resolution per-pixel semantic segmentation task. SeaFormer (Squeeze-enhanced Axial Transformer) designed a generic attention block characterized by the formulation of squeeze Axial and detail enhancement. Coupled with a light segmentation head, they achieve the best trade-off between segmentation accuracy and latency on the ARM-based mobile devices on the ADE20K and Cityscapes datasets. They beat both the mobile-friendly rivals and Transformer-based counterparts with better performance and lower latency.

### Open source status

- [X] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation

Paper: https://arxiv.org/pdf/2301.13156.pdf
Code and weights: https://github.com/fudan-zvg/SeaFormer
Authors: @wwqq @lzrobots @speedinghzl

cc: @NielsRogge @alaradirik

Comments:
Hi. I would like to work on this.

Hi @inderpreetsingh01 thanks for opening the issue, SeaFormer definitely seems like a good addition to the library! 

Are you planning to work on this model? If not, @strankid could start working on it or you two could collaborate on a PR. In either case, you could take a look at our [model addition guidelines](https://huggingface.co/docs/transformers/add_new_model), as well as the transformers code of other segmentation models such as [SegFormer](https://github.com/huggingface/transformers/tree/main/src/transformers/models/segformer), [MaskFormer](https://github.com/huggingface/transformers/tree/main/src/transformers/models/maskformer), [Mask2Former](https://github.com/huggingface/transformers/tree/main/src/transformers/models/mask2former) and [OneFormer](https://github.com/huggingface/transformers/tree/main/src/transformers/models/oneformer).

hello, fancy to make [SETR](https://github.com/fudan-zvg/SETR) on board？ 

@alaradirik should I begin with a WIP PR? 

Hi @alaradirik thanks for sharing the resources. I will be working on adding this model. @strankid if you want we can collaborate on this. @lzrobots i saw both SeaFormer and SETR use mmseg, we can look into it.

@inderpreetsingh01 i'm down to collaborate! 

Great :) @strankid @inderpreetsingh01 you can ping me if you have questions about the library or need help with anything (e.g. model conversion).

It'd be great if you could open a WIP PR,  as it'd make it easier to ask / answer questions and do a preliminary review later down the road.

thanks @alaradirik will do it. @strankid can you share your mail id so that we can connect on slack?

@inderpreetsingh01 my email is apoorv96@gmail.com. Should I create the PR or would you like to? 

@strankid sure you can create the pr.

@inderpreetsingh01 Saw you created the wip pr. Since you have my email, just contact me and let me know how you want to split the work.
Fix type in gpt2 config docstring
Author: WeberJulian
Pull request: yes

This PR corrects the type of the field `embd_pdrop` in the docstring of `configuration_gpt2.py`, the field should be a float not an int, like the default value `0.1` suggests.


## Who can review?
Documentation: @sgugger, @stevhliu and @MKhalusova



Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix en documentation typos
Author: tpaviot
Pull request: yes

# What does this PR do?

Fix a wrong URL as well as typos

## 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?


## Who can review?

Documentation: @sgugger, @stevhliu and @MKhalusova


Comments:
_The documentation is not available anymore as the PR was closed or merged._
OWLViT - Allow text model to compute text embeddings only once
Author: ekazakos
Pull request: no

### Feature request

Hi again, 

Currently, the OWL-ViT pipeline works by having a list of queries **per example** (e.g. for classification problems with 10 classes there would be 10 queries for each image). I understand that the rationale behind this is to allow to train with multiple datasets simultaneously where each dataset has a different set of classes, and where images from different dataset may be in the batch at the same time.

Nevertheless, in many settings (in most actually), we train/test using a single training/test set. And calculating the text embedding multiple times causes redundant computations. So, could you provide functionality for allowing the text embedding to be calculated only once? By once I mean **one time for each of the queries that correspond to the dataset classes**, and this to be used for all examples in the batch rather than calculating it for each batch element. Thank you!

cc @alaradirik 

Comments:
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.

This is a great feature request and can help in improving the usability of OWL-ViT. Please do consider.

cc @alaradirik 

Hi @amitjena40, sorry for my late reply! 

We looked into this issue and while we think it would make it easier to use OWL-ViT at a larger scale, it is a big breaking change as it requires introducing new arguments and rearranging multiple components.
[FX tracer] Make `concrete_args` from outside available
Author: lygztq
Pull request: yes

# What does this PR do?

Current `HFTracer` implementation will replace `concrete_args` with their default values from function signature, this behavior is different from the one in the description of flag `complete_concrete_args_with_inputs_not_in_dummy_inputs`:

> If `True`, and `dummy_inputs` is specified, every argument that `root` can take that is not in `dummy_inputs` **AND NOT IN `concrete_args`** will be added to `concrete_args`, otherwise does nothing.

## 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 documentation is not available anymore as the PR was closed or merged._

@michaelbenayoun Could you merge this PR? I have no write access. Thanks
HF models use deprecated pytorch function invocations
Author: ngimel
Pull request: no

Masks are frequently created in `uint8` type, see e.g. here https://github.com/huggingface/transformers/blob/8fb4d0e4b46282d96386c229b9fb18bf7c80c25a/src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py#L186 or here https://github.com/huggingface/transformers/blame/52dd2b61bff8af5b6409fdd5ec92a9b3114f3636/src/transformers/models/codegen/modeling_codegen.py#L101, and then used in `torch.where`. Use of `uint8` masks in `torch.where` has been deprecated for couple years, and though it still works in pytorch eager (with a warning), support for this has been removed in `torch.compile`. It would be good to audit places where uint8 masks are used and replace them with bool masks. 

Comments:
Thanks a lot for flagging @ngimel !

cc @ArthurZucker and @ydshieh 


Could use of `torch.where` be the cause of these `torch.compile()` errors in `AutoModelForSeq2SeqLM` models?

```text
  File "/home/kastanday/utils/mambaforge3/envs/torch2.0/lib/python3.10/site-packages/transformers/models/t5/modeling_t5.py", line 949, in <graph break in forward>
    raise ValueError(f"You have to specify either {err_msg_prefix}input_ids or {err_msg_prefix}inputs_embeds")
ValueError: You have to specify either input_ids or inputs_embeds
```
Unsupported `ConstantVariable(str)`:
```
  File "/home/kastanday/utils/mambaforge3/envs/torch2.0/lib/python3.10/site-packages/torch/_dynamo/exc.py", line 71, in unimplemented
    raise Unsupported(msg)
torch._dynamo.exc.Unsupported: call_function BuiltinVariable(ValueError) [ConstantVariable(str)] {}
```


Minimal reproduction:
```python
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

model_name = "google/flan-t5-base"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

model = torch.compile(model) # PyTorch 2.0

from torch import _dynamo
_dynamo.config.verbose = True
_dynamo.explain(model)
```

Thanks for any guidance. 

Should be fixed on monday the PR is ready 😉