I'm pretty sure this is the inverse of the issue noted in https://github.com/dmlc/xgboost/issues/5826, where XGBoost behaves differently on macOS when loading a JSON model.
Traceback (most recent call last):
File "/opt/lib/python/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/opt/lib/python/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/opt/lib/python/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/opt/lib/python/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/opt/lib/python/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/opt/lib/python/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/lib/python/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/opt/lib/python/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/opt/lib/python/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/lib/python/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/srv/app/api.py", line 51, in query
max_recommendations=data.get("max_recommendations", 20),
File "/srv/app/src/query.py", line 30, in run
self.model.load_model(self.datasetloader.get_model_path())
File "/opt/lib/python/site-packages/xgboost/sklearn.py", line 414, in load_model
self._Booster.load_model(fname)
File "/opt/lib/python/site-packages/xgboost/core.py", line 1604, in load_model
self.handle, c_str(os_fspath(fname))))
File "/opt/lib/python/site-packages/xgboost/core.py", line 188, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [09:00:14] ../src/common/json.cc:449: Unknown construct, around character position: 71
learn": '{"n_estThe issue may have to do with the fact that running the Linux-host built image results in some inconsistencies when that image is then run on a macOS host, but I'm not entirely sure.
As an aside, the JSON produced by xgboost.save_model() doesn't seem to be valid (note the use of single quotes in the stack trace) but it does seem to work with xgboost.load_model() 🤷