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

[spark] Add text2text generation #2506

Merged
merged 1 commit into from
Apr 10, 2023
Merged

Conversation

xyang16
Copy link
Contributor

@xyang16 xyang16 commented Apr 6, 2023

Description

Brief description of what this PR is about

Add text2text generation, see example: deepjavalibrary/djl-demo#331

@xyang16 xyang16 requested review from zachgk, frankfliu and a team as code owners April 6, 2023 00:45
@xyang16 xyang16 requested a review from lanking520 April 6, 2023 00:46
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2023

Codecov Report

Patch coverage: 72.16% and project coverage change: +1.60 🎉

Comparison is base (bb5073f) 72.08% compared to head (6ea42a9) 73.69%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2506      +/-   ##
============================================
+ Coverage     72.08%   73.69%   +1.60%     
- Complexity     5126     6913    +1787     
============================================
  Files           473      685     +212     
  Lines         21970    30203    +8233     
  Branches       2351     3122     +771     
============================================
+ Hits          15838    22258    +6420     
- Misses         4925     6429    +1504     
- Partials       1207     1516     +309     
Impacted Files Coverage Δ
api/src/main/java/ai/djl/modality/cv/Image.java 69.23% <ø> (-4.11%) ⬇️
...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java 76.00% <ø> (ø)
...rc/main/java/ai/djl/modality/cv/output/Joints.java 71.42% <ø> (ø)
.../main/java/ai/djl/modality/cv/output/Landmark.java 100.00% <ø> (ø)
...main/java/ai/djl/modality/cv/output/Rectangle.java 72.41% <0.00%> (ø)
...i/djl/modality/cv/translator/BigGANTranslator.java 21.42% <0.00%> (-5.24%) ⬇️
.../modality/cv/translator/ImageFeatureExtractor.java 0.00% <0.00%> (ø)
.../ai/djl/modality/cv/translator/YoloTranslator.java 27.77% <0.00%> (+18.95%) ⬆️
...ain/java/ai/djl/modality/cv/util/NDImageUtils.java 67.10% <0.00%> (+7.89%) ⬆️
api/src/main/java/ai/djl/modality/nlp/Decoder.java 63.63% <ø> (ø)
... and 228 more

... and 353 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

:param dataset: input dataset
:return: output dataset
"""
if not self.model_url and not self.model_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe check for not both

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like: if not any([self.model_url, self.model_name])?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically xor. Must have one or the other but not both. bool(self.model_url) ^ bool(self.model_name) should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was assuming both should be fine. Just model_url has higher priority than model_name.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is fine, but not great. For cases like this, I tend to ask whether a user would expect that this is the behavior of the API. If they did provide both, would they expect that priority? Instead, an error is clearer because having both properties when only a single one is used already means something is not right. The error will highlight that for the user and ensure they can clarify the situation rather then risk behaving in ways that they don't expect

:param dataset: input dataset
:return: output dataset
"""
if not self.model_url and not self.model_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

It is fine, but not great. For cases like this, I tend to ask whether a user would expect that this is the behavior of the API. If they did provide both, would they expect that priority? Instead, an error is clearer because having both properties when only a single one is used already means something is not right. The error will highlight that for the user and ensure they can clarify the situation rather then risk behaving in ways that they don't expect

@xyang16 xyang16 merged commit 54c9de2 into deepjavalibrary:master Apr 10, 2023
@xyang16 xyang16 deleted the alpaca branch May 2, 2023 19:58
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