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

SimpleSentimentModel should inherit from BatchedModel. #1363

Merged
1 commit merged into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lit_nlp/examples/simple_pytorch_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _from_pretrained(cls, *args, **kw):
return cls.from_pretrained(*args, from_tf=True, **kw)


class SimpleSentimentModel(lit_model.Model):
class SimpleSentimentModel(lit_model.BatchedModel):
"""Simple sentiment analysis model."""

LABELS = ["0", "1"] # negative, positive
Expand All @@ -103,7 +103,7 @@ def __init__(self, model_name_or_path):
##
# LIT API implementation
def max_minibatch_size(self):
# This tells lit_model.Model.predict() how to batch inputs to
# This tells lit_model.BatchedModel.predict() how to batch inputs to
# predict_minibatch().
# Alternately, you can just override predict() and handle batching yourself.
return 32
Expand Down
4 changes: 2 additions & 2 deletions lit_nlp/examples/sst_pytorch_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _from_pretrained(cls, *args, **kw):
return cls.from_pretrained(*args, from_tf=True, **kw)


class SimpleSentimentModel(lit_model.Model):
class SimpleSentimentModel(lit_model.BatchedModel):
"""Simple sentiment analysis model."""

LABELS = ["0", "1"] # negative, positive
Expand All @@ -95,7 +95,7 @@ def __init__(self, model_name_or_path):
##
# LIT API implementation
def max_minibatch_size(self):
# This tells lit_model.Model.predict() how to batch inputs to
# This tells lit_model.BatchedModel.predict() how to batch inputs to
# predict_minibatch().
# Alternately, you can just override predict() and handle batching yourself.
return 32
Expand Down
Loading