Skip to content

A bit hard to find and run eland_import_hub_model on Windows #551

Closed
@sakurai-youhei

Description

@sakurai-youhei
Member

Right after pip install eland, neither python -m eland nor eland_import-hub-model works on Windows.

C:\Users\YouheiSakurai>python -m eland
C:\Program Files\Python311\python.exe: No module named eland.__main__; 'eland' is a package and cannot be directly executed

C:\Users\YouheiSakurai>eland_import_hub_model
'eland_import_hub_model' is not recognized as an internal or external command,
operable program or batch file.
  1. python -m eland doesn't work because no of eland.__main__.
  2. eland_import-hub-model doesn't work because scripts is used instead of console_scripts in setup.py.

image

As the above picture shows, eland_import_hub_model is not executable on Windows due to no file extension like .exe.

I will open a PR to solve this hassle on Windows.

Activity

added a commit that references this issue on Jul 13, 2023
xuanyuanbao

xuanyuanbao commented on Dec 4, 2024

@xuanyuanbao

I also has error。what i can do make it work?

xuanyuanbao

xuanyuanbao commented on Dec 4, 2024

@xuanyuanbao

I also has error。what i can do make it work?

oh,thanks me, I have resolve this problem,it my code instead to eland_import_hub_model in shell,it works where your computer operation system is Windows。

secondly, my elasticsearch version is 8.6.0, but elasticsearch 8.7.0 also works

import elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel

# Load a Hugging Face transformers model directly from the model hub
tm = TransformerModel("sentence-transformers/clip-ViT-B-32-multilingual-v1", "text_embedding")

# Export the model in a TorchScrpt representation which Elasticsearch uses
tmp_path = "models"
Path(tmp_path).mkdir(parents=True, exist_ok=True)
model_path, config, vocab_path = tm.save(tmp_path)

ca_certs_path = "../app/conf/ca.crt"
# Import model into Elasticsearch
es = elasticsearch.Elasticsearch("https://elastic:AdZ4x8NxzC23i=A_jCrF@127.0.0.1:9200",
                                 ca_certs=ca_certs_path,
                                 verify_certs=True, timeout=300)  # 5 minute timeout

ptm = PyTorchModel(es, tm.elasticsearch_model_id())
ptm.import_model(model_path=model_path, config_path=None, vocab_path=vocab_path, config=config)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @sakurai-youhei@xuanyuanbao

      Issue actions

        A bit hard to find and run eland_import_hub_model on Windows · Issue #551 · elastic/eland