Skip to content

Commit

Permalink
fix(torchscript): runnable method collision (#3364)
Browse files Browse the repository at this point in the history
  • Loading branch information
bojiang authored Dec 15, 2022
1 parent 2c1c2a6 commit 98f6f63
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/bentoml/_internal/frameworks/torchscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,20 @@ def get_runnable(bento_model: Model):
from .common.pytorch import make_pytorch_runnable_method

partial_kwargs: t.Dict[str, t.Any] = bento_model.info.options.partial_kwargs # type: ignore
model_runnable_class = partial_class(
PytorchModelRunnable,
bento_model=bento_model,
loader=load_model,
)

for method_name, options in bento_model.info.signatures.items():
method_partial_kwargs = partial_kwargs.get(method_name)
PytorchModelRunnable.add_method(
model_runnable_class.add_method(
make_pytorch_runnable_method(method_name, method_partial_kwargs),
name=method_name,
batchable=options.batchable,
batch_dim=options.batch_dim,
input_spec=options.input_spec,
output_spec=options.output_spec,
)
return partial_class(
PytorchModelRunnable,
bento_model=bento_model,
loader=load_model,
)
return model_runnable_class

0 comments on commit 98f6f63

Please sign in to comment.