This message was deleted.
# ask-for-help
s
This message was deleted.
🏁 1
replied 1
j
Hi!
s
Hi
Jiang
j
Would you like share the content of service.py and the bentofile.yaml here?
s
yes
wait a sec
Copy code
service: "service.py:svc"  # Same as the argument passed to bentoml
labels:
  owner: Sarthak
  stage: development
include:
  - "*.py"  # A pattern for matching which files to include in the bento
python:
   packages:  # Additional pip packages required by the service
     - scikit-learn
     - numpy
     - pandas
     - pydantic
This is yaml file
Copy code
import numpy as np
import pandas as pd
from fastapi import FastAPI
from pydantic import BaseModel
import json
import typing
import bentoml
from <http://bentoml.io|bentoml.io> import JSON
from <http://bentoml.io|bentoml.io> import NumpyNdarray

BENTO_MODEL_TAG = "iris_clf:3byq2muajs7tt6e6"


iris_classifier_runner = bentoml.sklearn.get(BENTO_MODEL_TAG).to_runner()

svc = bentoml.Service("iris_classifier_pydantic", runners=[iris_classifier_runner])

class IrisFeatures(BaseModel):
    sepal_len:float
    sepal_width:float
    petal_len:float
    petal_width:float

    #Optional Field
    request_id:typing.Optional[int]
    
    class Config:
        extra="forbid"

input_spec=JSON(pydantic_model=IrisFeatures)
    
    
@svc.api(input=input_spec,output=NumpyNdarray())
async def classify(input_data:IrisFeatures)->np.ndarray:
    if input_data.request_id is not None:
        print("Received request Id :" ,input_data.request_id)

    input_df=pd.DataFrame([input_data.dict(exclude={"request_id"})])
    return await iris_classifier_runner.predict.async_run(input_df)
This is service.py
Any views?
j
I just verified that. It is a bug introduced by PR #3164.
Now we cannot build images on Windows
s
any other alternative to build container on windows?
j
We will fix this in next release. For now, you may try to install
bentoml
from my patch branch. (note: this branch is just a temporary fix. It will not persist for long time)
pip install git+<https://github.com/bojiang/bentoml.git@fix-containerize-windows>
👍 1
s
ok
let me check
do i need to uninstall bentoml first?
j
no need to uninstall first
s
ok
let me check
Yes..it worked..Thanks for help..Do update us when this bug will be fixed in next release!
n
@Sarthak Verma Hey Sarthak, I'm also a windows user. I think you know Windows Subsystem for Linux (WSL) is there for us if you want to do your development in Linux. Linux is generally preferred for doing development. So just try Ubuntu (WSL) also if it works.
👍 1
a
This issue has been fixed and will be included in the upcoming release
s
Hey Do you know how ro save pickled model file in bento ml store
a