Coder Social home page Coder Social logo

Comments (3)

marshmellow77 avatar marshmellow77 commented on June 12, 2024 1

Hi Rogerio, there is two ways to tell the inference toolkit to use a custom inference script:

  • You can have the inference script in your local environment and then point to it as you did when you created the HuggingFaceModel() instance
  • Or you can have the inference code in the tar.gz file, in which case there is no need to specify where the inference script is located.

In our call I only mentioned the first option, but in the links I sent to you they only mention the second option, so this is totally my fault, sorry. But when you use both options you get the error message you are seeing.

I personally have used the first approach in this notebook which I tested and it works: https://github.com/marshmellow77/text-summarisation-project/blob/main/4a_model_testing_deployed.ipynb

Hope this helps!

Cheers, Heiko

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

Hey @rogeriobromfman,

The error No such file or directory: './code' is showing up since you have defined source_dir="./code", in your HuggingFaceModel.
When you define source_dir & entrypoint in your HuggingFaceModel the python-sagemaker-sdk is looking for those file on the machine where you execute HuggingFaceModel.deploy and not inside the model.tar.gz.
That way there is no requirement to bundle your inference.py into model.tar.gz.

But if you have bundled the inference.py in your model.tar.gz you can simply remove source_dir and entry_point from the HuggingFaceModel and it should work.

from sagemaker-huggingface-inference-toolkit.

rogeriobromfman avatar rogeriobromfman commented on June 12, 2024

It worked! Having the inference code in the Notebook instance instead of the tar.gz file is what I was missing. Thank you so much Heiko and Philipp!!

from sagemaker-huggingface-inference-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.