Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 63: ordinal not in range(128) #19

Open
Meizijiu329 opened this issue Oct 25, 2022 · 1 comment

Comments

@Meizijiu329
Copy link

in drugex2,I've met this issue:
Traceback (most recent call last):
File "F:\drugex-v2.0\drugex-v2.0\trainer.py", line 27, in
A1 = utils.Predictor('output/single/DNN_%s_CHEMBL226_4.pkg' % z, type=z)
File "F:\drugex-v2.0\drugex-v2.0\utils\objective.py", line 27, in init
self.model = joblib.load(path)
File "F:\Anaconda3\envs\david4\lib\site-packages\joblib\numpy_pickle.py", line 587, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "F:\Anaconda3\envs\david4\lib\site-packages\joblib\numpy_pickle.py", line 506, in _unpickle
obj = unpickler.load()
File "F:\Anaconda3\envs\david4\lib\pickle.py", line 1088, in load
dispatchkey[0]
File "F:\Anaconda3\envs\david4\lib\pickle.py", line 1123, in load_persid
"persistent IDs in protocol 0 must be ASCII strings")
_pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings

@XuhanLiu
Copy link
Owner

Firstly, you have to check how you dumped your machine learning pkl model ever before with pickle?

This is what I did in the environ.py.

joblib.dump(model, out, compress=3)

param model: machine learning model with scikit-learn package.
param out: the file path with string format

Maybe you also try the following code to replace line 27 in objective.py, if you dump you model with pickle.

import pickle
file = open(path, 'rb')
self.model = pickle.load(file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants