Coder Social home page Coder Social logo

Comments (7)

philschmid avatar philschmid commented on June 12, 2024 1

Thats because your structure is not correct. It need to be

model.tar.gz
    code/
        inference.py
    config.json
    tf_model.h5
    special_tokens_map.json
    tokenizer.json
    tokenizer_config.json
    vocab.txt

You can take a look here

from sagemaker-huggingface-inference-toolkit.

la-cruche avatar la-cruche commented on June 12, 2024

ok nice! we should write that in the doc no? to have all model artifacts directly in the archive without folder hierarchy

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

It is actually documented here.
But I agree with you since you already into trouble we should make it more clear.

The Hugging Face Inference Toolkit allows user to override the default methods of the HuggingFaceHandlerService. Therefor the need to create a named code/ with a inference.py file in it. For example:

model.tar.gz/
|- pytroch_model.bin
|- ....
|- code/
|- inference.py
|- requirements.txt
In this example, pytroch_model.bin is the model file saved from training, inference.py is the custom inference module, and requirements.txt is a requirements file to add additional dependencies. The custom module can override the following methods:

from sagemaker-huggingface-inference-toolkit.

la-cruche avatar la-cruche commented on June 12, 2024

yes, what I meant is that the doc didn't say "don't create folders, have every file in the archive without any folder" right?

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

added this to the documentation.

Model artificat structure model.tar.gz

The model.tar.gz contains all required files to run your model including your model file either pytorch_model.bin, tf_model.h5, tokenizer.json , tokenizer_config.json etc. All model artifacts need to be directly in the archive without folder hierarchy.

examples for PyTorch:

model.tar.gz/
|- pytroch_model.bin
|- vocab.txt
|- tokenizer_config.json
|- config.json
|- special_tokens_map.json

from sagemaker-huggingface-inference-toolkit.

la-cruche avatar la-cruche commented on June 12, 2024

nice! but we agree that with custom model_fn the archive structure can be anything right? people would be responsible to write code that can parse it

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

Yes

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.