elasticsearch-labs icon indicating copy to clipboard operation
elasticsearch-labs copied to clipboard

'No known model deployment with id [my-elser-model]' in "retrievers_intro_notebook"

Open liu-xiao-guo opened this issue 1 year ago • 1 comments

I had a local setup using Elastic Stack 8.14. I tried to run the notebook at https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/introducing-retrievers/retrievers_intro_notebook.ipynb with some modification to make it work with my local setup.

I have an error with the following code:

for model_id in ["my-elser-model","my-e5-model"]:
    result = es.perform_request(
        "POST",
        f"/_ml/trained_models/{model_id}/deployment/_update",
        headers={"content-type": "application/json", "accept": "application/json"},
        body={"number_of_allocations": 1},
    )

image

However, I do not have error with the following code:

for model_id in [".elser_model_2","my-e5-model"]:
    result = es.perform_request(
        "POST",
        f"/_ml/trained_models/{model_id}/deployment/_update",
        headers={"content-type": "application/json", "accept": "application/json"},
        body={"number_of_allocations": 1},
    )

Please be noted that I did not install the linux_x6 version since I ran it on my macOS computer.

In addition, the following code:

response = es.search(
    index="imdb_movies",
    body={
        "retriever": {
            "standard": {
                "query": {
                    "text_expansion": {
                        "overview_sparse": {
                            "model_id": "my-elser-model",
                            "model_text": movie_search,
                        }
                    }
                }
            }
        },
        "size": 3,
        "fields": ["names", "overview"],
        "_source": False,
    },
)

for hit in response["hits"]["hits"]:
    print(f"{hit['fields']['names'][0]}\n- {hit['fields']['overview'][0]}\n")

It gave me the error like: image

However, the following code does not give me any error:

response = es.search(
    index="imdb_movies",
    body={
        "retriever": {
            "standard": {
                "query": {
                    "text_expansion": {
                        "overview_sparse": {
                            "model_id": ".elser_model_2",
                            "model_text": movie_search,
                        }
                    }
                }
            }
        },
        "size": 3,
        "fields": ["names", "overview"],
        "_source": False,
    },
)

for hit in response["hits"]["hits"]:
    print(f"{hit['fields']['names'][0]}\n- {hit['fields']['overview'][0]}\n")

image

liu-xiao-guo avatar Jul 19 '24 14:07 liu-xiao-guo