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

fix(framework): transformers vs 1.3.0 "TypeError: __init__() got an unexpected keyword argument 'task'" #4880

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

frostming
Copy link
Contributor

Fixes #4879

Signed-off-by: Frost Ming me@frostming.com

…nexpected keyword argument 'task'"

Fixes bentoml#4879

Signed-off-by: Frost Ming <me@frostming.com>
@frostming frostming requested a review from a team as a code owner July 24, 2024 09:51
@frostming frostming requested review from bojiang and removed request for a team July 24, 2024 09:51
@aarnphm
Copy link
Contributor

aarnphm commented Jul 24, 2024

wait how does the rename fix this?

@frostming
Copy link
Contributor Author

wait how does the rename fix this?

Because when loading model it looks for an attribute named ModelOptions to create the options, this is part of the framework protocol:

@property
def options(self) -> ModelOptions:
if self._cached_options is None:
if self.module and hasattr(self.imported_module, "ModelOptions"):
object.__setattr__(
self,
"_cached_options",
self.imported_module.ModelOptions(**self._options),
)
else:
object.__setattr__(self, "_cached_options", ModelOptions())
assert self._cached_options is not None
return self._cached_options

@aarnphm
Copy link
Contributor

aarnphm commented Jul 25, 2024

wait how does the rename fix this?

Because when loading model it looks for an attribute named ModelOptions to create the options, this is part of the framework protocol:

@property
def options(self) -> ModelOptions:
if self._cached_options is None:
if self.module and hasattr(self.imported_module, "ModelOptions"):
object.__setattr__(
self,
"_cached_options",
self.imported_module.ModelOptions(**self._options),
)
else:
object.__setattr__(self, "_cached_options", ModelOptions())
assert self._cached_options is not None
return self._cached_options

oh you are right, and since we remove the proxy bentoml.transformers we didn't have the ModelOptions import anymore.

@aarnphm aarnphm merged commit a148bb3 into bentoml:main Jul 25, 2024
49 of 53 checks passed
@frostming frostming deleted the fix/transformer-model-options branch July 25, 2024 00:51
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.

bug: transformers vs 1.3.0 "TypeError: __init__() got an unexpected keyword argument 'task'"
2 participants