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

Refactor Adapters #1056

Merged
merged 0 commits into from
Sep 5, 2020
Merged

Conversation

bojiang
Copy link
Member

@bojiang bojiang commented Sep 3, 2020

Description

Motivation and Context

How Has This Been Tested?

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature and improvements (non-breaking change which adds/improves functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Code Refactoring (internal change which is not user facing)
  • Documentation
  • Test, CI, or build

Component(s) if applicable

  • BentoService (service definition, dependency management, API input/output adapters)
  • Model Artifact (model serialization, multi-framework support)
  • Model Server (mico-batching, dockerisation, logging, OpenAPI, instruments)
  • YataiService gRPC server (model registry, cloud deployment automation)
  • YataiService web server (nodejs HTTP server and web UI)
  • Internal (BentoML's own configuration, logging, utility, exception handling)
  • BentoML CLI

Checklist:

  • My code follows the bentoml code style, both ./dev/format.sh and
    ./dev/lint.sh script have passed
    (instructions).
  • My change reduces project test coverage and requires unit tests to be added
  • I have added unit tests covering my code change
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #1056 into refactor-adapters will decrease coverage by 29.32%.
The diff coverage is 36.21%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           refactor-adapters    #1056       +/-   ##
======================================================
- Coverage              63.39%   34.07%   -29.33%     
======================================================
  Files                    124      128        +4     
  Lines                   8259     7895      -364     
======================================================
- Hits                    5236     2690     -2546     
- Misses                  3023     5205     +2182     
Impacted Files Coverage Δ
bentoml/__init__.py 100.00% <ø> (ø)
bentoml/artifact/fasttext_model_artifact.py 40.00% <ø> (ø)
bentoml/artifact/json_artifact.py 34.48% <ø> (-62.07%) ⬇️
bentoml/artifact/keras_model_artifact.py 20.63% <ø> (ø)
bentoml/artifact/onnx_model_artifact.py 84.05% <ø> (ø)
bentoml/artifact/text_file_artifact.py 43.47% <ø> (ø)
bentoml/cli/bento_management.py 0.00% <0.00%> (-31.04%) ⬇️
bentoml/cli/bento_service.py 0.00% <0.00%> (-71.43%) ⬇️
bentoml/cli/click_utils.py 0.00% <0.00%> (-70.84%) ⬇️
bentoml/cli/deployment.py 0.00% <ø> (-49.46%) ⬇️
... and 129 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fae9de...8bf1314. Read the comment docs.

@bojiang bojiang linked an issue Sep 4, 2020 that may be closed by this pull request
18 tasks
@bojiang bojiang requested a review from parano September 4, 2020 17:25
pieces["long"] = full_out
pieces["short"] = full_out[:7] # maybe improved later
pieces["error"] = None
pieces = {"long": full_out, "short": full_out[:7], "error": None}
Copy link
Member

Choose a reason for hiding this comment

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

what's the reason for this change? this is actually not our code, it is from the versioneer project

return detect_suitable_adapter(result[s])
if isinstance(result, (list, tuple)):
return detect_suitable_adapter(result[0])
# if isinstance(result, (list, tuple)):
Copy link
Member

Choose a reason for hiding this comment

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

remove?

"Missing required dependency 'pandas' for DataframeInput, install "
"with `pip install pandas`"
)
if typ != "frame":
Copy link
Member

Choose a reason for hiding this comment

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

Update the docs above?

Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to just remove the typ parameter?

"""

def decorator(func):
_api_name = func.__name__ if api_name is None else api_name
validate_inference_api_name(_api_name)

if input is None:
# support bentoml<=0.7
# Support passing the desired adapter without instantiation
Copy link
Member

Choose a reason for hiding this comment

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

nit: "Raise error when input adapter class passed without instantiation"


def handle_cli(self, cli_args: Sequence[str]) -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--max-batch-size", default=sys.maxsize, type=int)
Copy link
Member

Choose a reason for hiding this comment

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

could we set a somewhat practical default value here? e.g. 1000?

@bojiang bojiang changed the base branch from master to refactor-adapters September 5, 2020 07:52
@bojiang bojiang merged commit 8bf1314 into bentoml:refactor-adapters Sep 5, 2020
@bojiang
Copy link
Member Author

bojiang commented Sep 5, 2020

Moved to #1070

@bojiang bojiang deleted the input-adapters-2 branch September 5, 2020 08:00
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.

Refactor adapters
2 participants