Folder access error in API endpoint

Registered Posts: 8

In the API endpoint script, I get an error when trying to access a folder which is placed in the resources of my environment, it's a sentence transformer model which I need to access.

Can someone please suggest?
Screenshot 2024-04-30 161656.png

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Registered Posts: 8
    edited July 2024

    In the API code I'm accessing this env in this way

    sentence_transformer_home = os.getenv('SENTENCE_TRANSFORMERS_HOME')
    model_path = os.path.join(sentence_transformer_home, 'sentence-transformers_all-MiniLM-L6-v2')
    model = SentenceTransformer(model_path)
  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,405 Neuron

    Check the permissions of that folder / file and if exists in your API node. It looks like you may need to download the transformers model first before you can invoke it in your function. The API node is a different machine so it won’t have the same thing your Designer node has.

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,405 Neuron
    edited July 2024

    What is

    SENTENCE_TRANSFORMERS_HOME

    set to? And have you installed the transformers model in this folder?

  • Registered Posts: 8

    It's
    Screenshot 2024-05-02 101109.png

    also yes, I have downloaded the model
    Screenshot 2024-05-02 101220.png

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,405 Neuron

    As you can see by the error the code is looking for the model in a tmp directory Dataiku uses to deploy the service. This is not desirable. You should download the model in a generic location in your API node machine and then use an absolute path to reference it in your API service code. That way any service using the transformers model can use the same downloaded model.

  • Registered Posts: 8

    That makes sense, thank you @Turribeach
    , I'll try this approach.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.
Top