2019-09-01 12:46:11 UTC - Pepi Paraskevoulakou: i saved my machine learning model in a pickle file i made it zip along the below code
import pickle def main(args): x = args.get(“x”) model = pickle.load(open(‘model.pkl’,‘rb’)) prediction = model.predict([[x]]) return {“the prediction is”: prediction} but when i tried to invoke the action the result was “”error”: “The action did not return a dictionary.” ” , i opened the logs and there it was: 2019-09-01T12:36:40.649056069Z stderr: Traceback (most recent call last): 2019-09-01T12:36:40.649189284Z stderr: File “pythonrunner.py”, line 88, in run 2019-09-01T12:36:40.649196589Z stderr: exec(‘fun = %s(param)’ % self.mainFn, self.global_context) 2019-09-01T12:36:40.649199652Z stderr: File “<string>“, line 1, in <module> 2019-09-01T12:36:40.649203101Z stderr: File “__main__.py”, line 4, in main 2019-09-01T12:36:40.649205933Z stderr: FileNotFoundError: [Errno 2] No such file or directory: ‘model.pkl’ anyone an idea??? https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1567341971022300 ---- 2019-09-01 15:30:08 UTC - Rodric Rabbah: with your code snippet above i am not reproducing your error (using python:3) which runtime image did you use https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1567351808022800 ---- 2019-09-01 16:11:04 UTC - Pepi Paraskevoulakou: this is the code that produces the trained model https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1567354264023100 ---- 2019-09-01 16:11:48 UTC - Pepi Paraskevoulakou: and this is the csv dataset for training https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1567354308023400 ---- 2019-09-01 16:13:27 UTC - Pepi Paraskevoulakou: afterwards i made a zip file including the __main__.py along with the model.pkl from the first code https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1567354407024500 ----