KEMBAR78
Ensure tensors are at least 1d for pad and concat by Yard1 · Pull Request #17179 · huggingface/transformers · GitHub
Skip to content

Conversation

@Yard1
Copy link
Contributor

@Yard1 Yard1 commented May 11, 2022

What does this PR do?

Ensures that tensors are at least 1d in pad_and_concatenate utility functions, and uses atleast_1d methods uniformly in the entire file.

Fixes # (issue)

Before submitting

  • 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,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? 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, and
    here are tips on formatting docstrings.
  • 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.

@Yard1
Copy link
Contributor Author

Yard1 commented May 11, 2022

cc @sgugger

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 11, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The fix looks good but we need something that supports more PyTorch versions.

Also, could you add a test that is failing without the fix? Or do we say such a test is going to be the current failing test in #17166 ?

@Yard1 Yard1 requested a review from sgugger May 11, 2022 14:11
@Yard1
Copy link
Contributor Author

Yard1 commented May 11, 2022

let me add a quick unit test

@Yard1
Copy link
Contributor Author

Yard1 commented May 11, 2022

@sgugger I am not sure what's up with code quality CI. I cannot reformat the file it complains about locally. Any idea what could be causing this?

I have removed the changes to the offending file, let's see if that fixes it.

@Yard1
Copy link
Contributor Author

Yard1 commented May 11, 2022

Ok, CI is green now :D

@sgugger sgugger merged commit 47412c7 into huggingface:main May 11, 2022
@sgugger
Copy link
Collaborator

sgugger commented May 11, 2022

Thanks again!

@Yard1 Yard1 deleted the ensure_atleast_1d branch May 11, 2022 17:58
ArthurZucker pushed a commit to ArthurZucker/transformers that referenced this pull request May 12, 2022
* Ensure tensors are at least 1d for pad and concat

* Compatibility

* Fix

* Fix

* Add test

* Retrigger CI

* Consistency with master

* Retrigger CI
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
* Ensure tensors are at least 1d for pad and concat

* Compatibility

* Fix

* Fix

* Add test

* Retrigger CI

* Consistency with master

* Retrigger CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants