https://dagster.io/ logo
m

Marieke

04/23/2020, 11:40 PM
I built a simple pipeline to apply an xgboost model to a new dataset and I'm getting issues with loading the pickled model object
Copy code
_pickle.UnpicklingError: NEWOBJ class argument isn't a type object
Does anyone know why dagster isn't recognizing the object?
m

max

04/23/2020, 11:48 PM
would you mind sharing more of the traceback?
m

Marieke

04/23/2020, 11:49 PM
sure!
Copy code
_pickle.UnpicklingError: NEWOBJ class argument isn't a type object
  File "/usr/local/lib/python3.7/site-packages/dagster/core/errors.py", line 174, in user_code_error_boundary
    yield
  File "/usr/local/lib/python3.7/site-packages/dagster/core/execution/plan/execute.py", line 689, in _user_event_sequence_for_step_compute_fn
    for event in gen:
  File "/usr/local/lib/python3.7/site-packages/dagster/core/execution/plan/compute.py", line 93, in _execute_core_compute
    for step_output in _yield_compute_results(compute_context, inputs, compute_fn):
  File "/usr/local/lib/python3.7/site-packages/dagster/core/execution/plan/compute.py", line 64, in _yield_compute_results
    for event in user_event_sequence:
  File "/usr/local/lib/python3.7/site-packages/dagster/core/definitions/decorators.py", line 421, in compute
    result = fn(context, **kwargs)
  File "/opt/dagster/pipelines/dagster_examples/xgboost_test.py", line 20, in apply_model
    model = pickle.load(infile)
m

max

04/24/2020, 12:27 AM
what is writing
dagster_examples/model_pickle.dat
?
m

Marieke

04/24/2020, 12:28 AM
it's a saved object in the repo
I built it in jupyter
m

max

04/24/2020, 12:28 AM
and what is the python type of that pickled object?
m

Marieke

04/24/2020, 12:29 AM
xgbclassifier
m

max

04/24/2020, 12:29 AM
hmm, ok
m

Marieke

04/24/2020, 12:29 AM
this script works in jupyter also, I can load this object in a notebook and apply without issues
m

max

04/24/2020, 12:30 AM
my first suspicion would be that maybe you're using a different version of python/pickle in jupyter than with dagster
m

Marieke

04/24/2020, 12:30 AM
is it that it's using python slim?
(dagster)
m

max

04/24/2020, 12:30 AM
i would be curious to see if using
XGBClassifier.dump_model
and
XGBClassified.load_model
resolved this
m

Marieke

04/24/2020, 12:31 AM
good point lemme try that
m

max

04/24/2020, 12:31 AM
well, it depends what environment you're running dagster in. you could run
python --version
and
which python
in that environment and compare it against
jupyter kernelspec list
m

Marieke

04/24/2020, 12:32 AM
they're both on 3.7
m

max

04/24/2020, 12:35 AM
and in the notebook you're just calling
pickle.dump
?
m

Marieke

04/24/2020, 12:35 AM
yeah
I also tried dill
m

Marieke

04/24/2020, 12:37 AM
OHHH
lemme see
that fixed it! On to the new error 😆
🚀 1
thank you!
m

max

04/24/2020, 1:00 AM
np!
2 Views