transformers icon indicating copy to clipboard operation
transformers copied to clipboard

DataCollatorWithFlattening is incompatible with non - list input ids

Open alex-hh opened this issue 1 year ago • 2 comments

System Info

latest transformers

Who can help?

@ArthurZucker

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

from transformers import GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained("openai-community/gpt2")
example = tokenizer("A test sentence", return_tensors="pt")
example = {k: v.flatten() for k, v in tensor_example.items()}
collator([example]*2)

Expected behavior

Collator should work with all output types supported by tokenizer.

alex-hh avatar Oct 04 '24 13:10 alex-hh

Hi! I am planning on working on this under Hacktoberfest 2024. Can you assign me this issue? I hope I am able to solve this

gaurangk19 avatar Oct 07 '24 13:10 gaurangk19

Hey! We do not assign issues, feel free to open a PR 🤗

ArthurZucker avatar Oct 17 '24 15:10 ArthurZucker

@ArthurZucker , Would you be able to review and merge this request? Thank you.

sudhanshu746 avatar Oct 29 '24 10:10 sudhanshu746