Comments (7)
Thanks for reporting this @mundruid.
Elasticsearch 8.11 should work with your model. What version of XGBoost did you create the model with?
from eland.
I created XGBClassifier with eland
8.11.0 and I can upload to Elastic 8.11.1. I am able to upload the XGBClassifier model.
If I convert the exact same model from XGBClassifier to RandomForestClassifier
, I get the bad request error mentioned above.
from eland.
There was as similar error reported in #255 where the model upload failed because it was too big for the HTTP buffer. H/ow big is your model @mundruid?
The resolution was to compress the model definition #255 (comment)
from eland.
The Random Forest Classifier is 36372 Bytes. I have tried the resolution and I get an error: "Connection #0 to host cas-aggregator.es.us-east-1.aws.elastic-cloud.com left intact
{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:0] [trained_model_definition] Expected START_OBJECT but was: null"}],"type":"x_content_parse_exception","reason":"[1:0] [trained_model_definition] Expected"
Is anyone else able to upload Random Forest Classifier models with these versions of Eland and Elastic? Is there a min/max size?
from eland.
@mundruid there is actually a test that creates a random RandomForestClassifier
model and uploads it Elasticsearch, that test passes when I run it locally with pytest tests/ml/test_ml_model_pytest.py::TestMLModel::test_random_forest_classifier
and it passes in CI runs.
https://github.com/elastic/eland/blob/main/tests/ml/test_ml_model_pytest.py#L417
The failure you are seeing may be specific to your model, or due to a certain combinations of dependencies.
What version of sklearn do you have installed?
My eland version is: 8.11.0 and elasticsearch version is 8.11.1 when the above error happens.
The versions of Elastic I was able to upload the RandomForestClassifier is: 7.17.1 and 7.17.5.
Can you upload the model to Elasticsearch 7.17 with Eland 8.11.1?
from eland.
I only have a 7.17.5 cluster left and I tried Eland 8.11.1 and still getting a bad request error.
The model that cannot be uploaded was uploaded using the following method recommended by Elastic. This may help so I am pasting here what I did:
- Transform the model to json:
import json
from eland.ml.transformers import get_model_transformer
# (Same inputs as ImportedMLModel)
transformer = get_model_transformer(
model,
feature_names=feature_names,
classification_labels=classification_labels,
classification_weights=classification_weights,
)
# Put this into the GitHub issue
print(json.dumps(transformer.transform().to_dict())
- Compress:
python print_ml_model.py > upload.json
jq -j '{"trained_model": .}' upload.json | gzip | base64 > compressed_definition.txt
COMPRESSED_DEF=$(cat compressed_definition.txt); FEATURE_NAMES=$(jq '.ensemble.feature_names' upload.json); echo "{\"compressed_definition\": \"$COMPRESSED_DEF\", \"input\": {\"field_names\": $FEATURE_NAMES}, \"inference_config\":{\"classification\":{}}}" > my_model.json
- Upload with curl:
curl -v -X PUT -H "Content-Type: application/json" -d @my_model.json <elasticsearch_endpoint>/_ml/trained_models/<your-model-name>
If you would like me to share the model json please let me know. I do not think I can share it on a public forum but I can send you a PM.
from eland.
This issue can be closed. Based on the workaround above I can upload my model. I still cannot upload it with Eland, however based on discussions with Elastic support, this does not seem to be an issue with Eland but with how my model is saved with scikit.
from eland.
Related Issues (20)
- elastic/eland Docker hub image is missing. HOT 4
- `eland_import_hub_model --task-type text_classification` fails HOT 2
- Make access_token an optional parameter in TransformerModel HOT 1
- Simplify model import code
- Improve compatibility testing of supported NLP models HOT 1
- Reduce transitive dependencies from sentence-transformers
- Add model JinaBertForMaskedLM to the supported list. HOT 1
- Investigate model test failures in CI
- A possible issue with eland.Dataframe.value_counts(), the statistical information is missing some values
- Is there a way to return _scores when using es_query or es_match?
- [NLP] Unable to install eland[pytorch] using pip due to unable to find matching pytorch HOT 2
- Cannot append fields of type "dense vectorfield type
- Cannot append fields of type "dense_vector" to an existing index HOT 1
- why openai/clip-vit-base-patch32 model not support ! HOT 2
- support adding cert path to eland_import_hub_model script HOT 4
- Feedback 🗣️
- Failed to import huggingface model: cardiffnlp/twitter-roberta-base-sentiment HOT 1
- Upgrade PyTorch to version 2.1.2 and
- Support Python 3.11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eland.