question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading scikit-learn pipeline with ray serve raises async_goal_exception

See original GitHub issue

Search before asking

  • I searched the issues and found no similar issues.

Ray Component

Ray serve

What happened + What you expected to happen

I am using a scikit-learn pipeline that is saved as a pickled file. When I load the pipeline again everything is fine and I can use it as expected. But I am not able to load the pickled file when using the @serve.deployment mechanism. I can open it with open() but as soon as I use pickle.load() it fails

@serve.deployment(num_replicas=1)
class Model():
  def __init__(self):
    pipe_file = "dump.pkl"
    assert os.path.exist(pipe_file), "File not found"

    with open(pipe_file,"rb") as f:
      self.pipe = pickle.load(f)

  def __call__(self):
    return self.pipe.transform(np.random.random(100,100))

Model.deploy()

It just fails raising async_goal_exception

Versions / Dependencies

Ray: 1.9.1 Python: 3.7.2 and also 3.9.7 OS: Ubuntu 18.04 LTS

Reproduction script

I created a very simple toy example that can be run in colab and creates the same error

https://colab.research.google.com/gist/markste-in/5a80cb9b5d7a71888c31f1c1d53c544e/ray_issue.ipynb

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shrekris-anyscalecommented, Jan 3, 2022

Thanks for the feedback– I added a Github issue about Serve exception handling, so we can track it. Good luck!

0reactions
markste-incommented, Jan 3, 2022

Update: It seems I opened the file with open(file_path,“wb”) instead of open(file_path,“rb”).

That seems to throw async_goal_exception.

I am not sure if it would be possible to improve the error handling since “async_goal_exception” obfuscate the real issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model selection and serving with Ray Tune and Ray Serve
This tutorial will show you an end-to-end example how to train a model using Ray Tune on incrementally arriving data and deploy the...
Read more >
sklearn Pipeline
The purpose of the pipeline is to assemble several steps that can be cross-validated together while setting different parameters.
Read more >
Automated Hyperparameter Tuning | Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sources.
Read more >
Prediction with a custom scikit-learn pipeline - Google Cloud
The goal is to train a scikit-learn pipeline that predicts whether a person makes more ... raise Exception('{} does not start with gs://'.format(gcs_uri))...
Read more >
Pyodide
including numpy, pandas, scipy, matplotlib, and scikit-learn. ... With Python 3.7.5+ you can serve Pyodide files locally with http.server:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found