Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add return_tensor parameter for feature extraction #19257

Merged

Conversation

ajsanjoaquin
Copy link
Contributor

What does this PR do?

Fixes #10016

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,
    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.
  • [x ] Did you write any new necessary tests?

Addresses stale issue #10016. Please review @LysandreJik and @Narsil. Thanks.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 30, 2022

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

Copy link
Contributor

@Narsil Narsil left a comment

Choose a reason for hiding this comment

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

All up for it.

This PR needs to add some kind of test to make sure this argument works

Ideally in tests/pipelines/test_pipelines_feature_extraction.py::run_pipeline_test that way we make sure it works for all pipeline that are supposed to work.

src/transformers/pipelines/feature_extraction.py Outdated Show resolved Hide resolved
src/transformers/pipelines/feature_extraction.py Outdated Show resolved Hide resolved
@ajsanjoaquin ajsanjoaquin force-pushed the feature-extraction-return-tensor branch from b426b78 to a0677bf Compare October 5, 2022 17:07
@ajsanjoaquin
Copy link
Contributor Author

Feedback has been addressed :)

@Narsil
Copy link
Contributor

Narsil commented Oct 6, 2022

Not sure what's happening with CircleCI...

@ajsanjoaquin
Copy link
Contributor Author

Last suggestion was addressed, but CircleCI Pipeline still seems broken...

@Narsil
Copy link
Contributor

Narsil commented Oct 7, 2022

@ajsanjoaquin do you have circleCI set up on your account/branch ? I remember people sometimes having issues because of this.

Otherwise, could you try to rebase on main?

Pinging @LysandreJik that might know more.

@LysandreJik
Copy link
Member

The CircleCI pipeline seems to be working again!

@ajsanjoaquin ajsanjoaquin force-pushed the feature-extraction-return-tensor branch from fa74148 to 771b975 Compare October 10, 2022 13:39
@Narsil
Copy link
Contributor

Narsil commented Oct 10, 2022

For quality can you try

pip install transformers[dev]
make fixup

?

@ajsanjoaquin
Copy link
Contributor Author

ajsanjoaquin commented Oct 10, 2022

@Narsil when running make fixup, I get the following error. Perhaps it's possible to replicate on your end?

-n was unexpected at this time.
make: *** [Makefile:10: modified_only_fixup] Error 255

@Narsil
Copy link
Contributor

Narsil commented Oct 11, 2022

-n was unexpected at this time.

What OS/Linux flavor you're running on ? Shell maybe ?
Seems like test -n is not supported in your environment.

@ajsanjoaquin
Copy link
Contributor Author

I'm in a temporary dev environment, so I'm using Windows 😅. I'll use WSL next time. So the formatting error was simply a result of missing newline before importing torch and tf?

@Narsil
Copy link
Contributor

Narsil commented Oct 11, 2022

I'm in a temporary dev environment, so I'm using Windows sweat_smile. I'll use WSL next time. So the formatting error was simply a result of missing newline before importing torch and tf?

We use black and isort to normalize as much as possible the code, so yes import order is automatically done for you.

@ajsanjoaquin
Copy link
Contributor Author

@Narsil can this PR be merged soon when it passes all tests? I just resolved a conflict made by a different commit on the same file.

@Narsil
Copy link
Contributor

Narsil commented Oct 12, 2022

@ajsanjoaquin
It seems there is an issue with your CircleCI permissions, the tests won't run.
Could you try refreshing your permissions as shown here ?

@ajsanjoaquin ajsanjoaquin force-pushed the feature-extraction-return-tensor branch from 0184e44 to 2ab8d05 Compare October 12, 2022 23:35
@ajsanjoaquin
Copy link
Contributor Author

@Narsil the check_repository_consistency test is failing because of a .md file unrelated to my PR. Do I have to address this in this PR?

check_code_quality is again failing and I can't use make fixup. I request you re-fix the latter.

I hope this can be passed soon before another PR like #19382 modifies the exact code I was working on...

ajsanjoaquin and others added 3 commits October 17, 2022 11:27
add return_tensor parameter for feature extraction

Revert "Merge branch 'feature-extraction-return-tensor' of https://github.com/ajsanjoaquin/transformers into feature-extraction-return-tensor"

This reverts commit d559da7, reversing
changes made to bbef892.
Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>
@Narsil Narsil force-pushed the feature-extraction-return-tensor branch from 2ab8d05 to da1c7be Compare October 17, 2022 09:31
Copy link
Contributor

@Narsil Narsil left a comment

Choose a reason for hiding this comment

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

LGTM.

I took the liberty of rebasing and fixing your PR. Is the result OK for you ?

@sgugger for final review.

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 adding this! Just one nit on the docstring.

src/transformers/pipelines/feature_extraction.py Outdated Show resolved Hide resolved
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
@sgugger sgugger merged commit 35bd089 into huggingface:main Oct 17, 2022
@sgugger
Copy link
Collaborator

sgugger commented Oct 17, 2022

This PR was based on an old fork of the repo and as such, the pipeline tests were not run. They do not pass, so I will revert the commit. Could you open a new PR with fixed tests?

@Narsil
Copy link
Contributor

Narsil commented Oct 17, 2022

I am confused, should we re-open a PR or start from here #19679

(I tried re-opening a PR but it resulted in a no-op...)

@ajsanjoaquin ajsanjoaquin deleted the feature-extraction-return-tensor branch October 18, 2022 15:13
kashif pushed a commit to kashif/transformers that referenced this pull request Oct 21, 2022
* add return_tensors parameter for feature_extraction  w/ test

add return_tensor parameter for feature extraction

Revert "Merge branch 'feature-extraction-return-tensor' of https://github.com/ajsanjoaquin/transformers into feature-extraction-return-tensor"

This reverts commit d559da7, reversing
changes made to bbef892.

* call parameter directly

Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>

* Fixup.

* Update src/transformers/pipelines/feature_extraction.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
kashif pushed a commit to kashif/transformers that referenced this pull request Oct 21, 2022
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.

Feature-extraction pipeline to return Tensor
5 participants