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

Update validation for NLP tasks #59

Merged
merged 3 commits into from
May 28, 2021
Merged

Update validation for NLP tasks #59

merged 3 commits into from
May 28, 2021

Conversation

osanseviero
Copy link
Member

@osanseviero osanseviero commented May 28, 2021

Summary of changes:

  • Aligned max length with max_new_tokens in docs.
  • Changed max_length to max_new_tokens for text-generation, which I think would be the right param.
  • Added return_full_text and num_return_sequences for text-generation
  • Added summarization, table-question-answering, and text2text-generation validation.
  • Fixed conversational. It was using params instead of inputs, and the inputs are others.

Let me know if you disagree with any and I can revert :)

@osanseviero osanseviero requested a review from Narsil May 28, 2021 14:32
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.

I'm fine with enabling max_new_tokens by default instead of max_length however, I think that it should get its own validation class.

For conversation, we were missing the input validation for sure, but the parameters still do exist (but they are NOT the same as text anymore though, return_num_sequences is impossible for instance, at least in transformers.)

I know it's cumbersome to write many repetitive tests, but overall I think it works better than parametrizing, as parametrization leaves more room for silently failing tests, and reading tests when they actually are failing is sometimes hard to untangle and update (especially when the tests you want to modify need to significantly differ from what they are tied to).

ofc all this is a taste matter, so consider the remarks about testing as NITs

api-inference-community/tests/test_nlp.py Outdated Show resolved Hide resolved
@osanseviero
Copy link
Member Author

osanseviero commented May 28, 2021

For conversation, I don't see any params in the docs. I'm trying to keep them in sync. As far as I understand, all of these seq2seq models call a generate function in Transformers, so I'm not sure which would be the eligible params for conversation.

@Narsil
Copy link
Contributor

Narsil commented May 28, 2021

top_p,top_k, repetition_penalty, max_time etc... are valid.

You are correct, it's using generate, it's either full decoder (DialoGPT-large) or encoder-decoder (Blenderbot).

The only reason it's not entirely the text-generation parameters, it's because of the return type which is a dictionary and so num_return_sequences would require returning a list.
We definitely can add them to the docs.

@osanseviero osanseviero requested a review from Narsil May 28, 2021 16:37
@osanseviero
Copy link
Member Author

Updates

  • Changed to a shared params class for the generation ones with specific params in subclasses
  • Reverted max_tokens to be consistent with the 3 types.
  • Added param validation for conversational.
  • De-parameterized some of the tests
  • Added validation for max_length > min_length.

I'll send another PR for updating docs

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

@osanseviero osanseviero merged commit 165ebbe into main May 28, 2021
@osanseviero osanseviero deleted the typings branch May 28, 2021 18:10
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.

None yet

2 participants