pzmm.MLFlowModel.read_mlflow_model_file() failed with JSONDecodeError: Extra data
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu trong sasctl/pzmm/mlflow_model.py tại MLFlowModel.read_mlflow_model_file(), đặc biệt là phần phân tích inputs_dict và outputs_dict được hiển thị trong stack trace. Tái hiện ví dụ với thư mục mô hình MLflow được tham chiếu và kiểm tra metadata mô hình được tạo; được xem là hoàn tất khi phương thức trả về ba dictionary như mong đợi mà không có JSONDecodeError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the issue
Trying to read mlflow model using pzmm.MLFlowModel.read_mlflow_model_file result in JSONDecodeError. I'm just using a simple example from here:
https://medium.com/@rehabreda/registering-mlflow-models-to-sas-model-manager-using-sasctl-a-comprehensive-guide-a47dbf183338
To Reproduce
The rest of the training code can be found on the above link. The code that perform the read mlflow model file is shown below:
## define randomforest model
model = RandomForestClassifier(n_estimators=300).fit(x_train, y_train)
##Model signature defines schema of model input and output
signature = infer_signature(x_train, model.predict(x_train))
## log model score to mlflow
score = model.score(x_test, y_test)
print("Score: %s" % score)
mlflow.log_metric("score", score)
### log model
mlflow.sklearn.log_model(model, "model", signature=signature)
print("Model saved in run %s" % mlflow.active_run().info.run_uuid)
mlPath = Path(f'./mlruns/1/{mlflow.active_run().info.run_uuid}/artifacts/model')
## get info aboud model variables ,input and output
varDict, inputsDict, outputsDict = pzmm.MLFlowModel.read_mlflow_model_file(mlPath)
Expected behavior
Getting the dictionary successfully from pzmm.MLFlowModel.read_mlflow_model_file().
Stack Trace
If you're experiencing an exception, include the full stack trace and error message.
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
Cell In[4], line 4
1 mlPath = Path(f'./mlruns/1/{mlflow.active_run().info.run_uuid}/artifacts/model')
3 ## get info aboud model variables ,input and output
----> 4 varDict, inputsDict, outputsDict = pzmm.MLFlowModel.read_mlflow_model_file(mlPath)
File ~\AppData\Local\miniconda3\envs\ml\Lib\site-packages\sasctl\pzmm\mlflow_model.py:56, in MLFlowModel.read_mlflow_model_file(cls, m_path)
53 outputs = m_lines[ind_out[0] : -1]
55 inputs_dict = json.loads("".join([s.strip() for s in inputs])[9:-1])
---> 56 outputs_dict = json.loads("".join([s.strip() for s in outputs])[10:-1])
57 else:
58 raise ValueError(
59 "Improper or unset signature values for model. No input or output "
60 "dicts could be generated. "
61 )
File ~\AppData\Local\miniconda3\envs\ml\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
341 s = s.decode(detect_encoding(s), 'surrogatepass')
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
348 cls = JSONDecoder
File ~\AppData\Local\miniconda3\envs\ml\Lib\json\decoder.py:340, in JSONDecoder.decode(self, s, _w)
338 end = _w(s, end).end()
339 if end != len(s):
--> 340 raise JSONDecodeError("Extra data", s, end)
341 return obj
JSONDecodeError: Extra data: line 1 column 73 (char 72)
Version
1.10.0
- Ngôn ngữ chính
- Python
- Star
- 52
- Fork
- 45
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sassoftware/python-sasctl
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
sassoftware/python-sasctl#224 ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
sassoftware/python-sasctl#216 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
sassoftware/python-sasctl#207 · 1 reaction ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
sassoftware/python-sasctl#202 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
sassoftware/python-sasctl#193 ·
Tất cả issue của sassoftware/python-sasctl
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fritzprix/libr-agent#2612 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage presubmit-gate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
gke-labs/kube-agents#5001 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
simonw/sqlite-utils#928 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
colorado
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
freelawproject/juriscraper#2405 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
cline/mcp-marketplace#3576 ·