Skip to content
Snippets Groups Projects
Commit 3979bfca authored by Ahmed Markhoos's avatar Ahmed Markhoos
Browse files

Replacing cloudpickle with dill as a fix for pickling locked objects

parent 7a9a9b23
Branches 44-data-content-interface
No related tags found
1 merge request!68dill replacement and keras fix
Pipeline #12698 failed
import base64
import cloudpickle
import dill
def python_to_str(obj):
"""
Convert an arbitrary python object into a string and encode it in base64.
"""
obj_string = cloudpickle.dumps(obj)
obj_string = dill.dumps(obj)
obj_base64 = base64.b64encode(obj_string).decode()
return obj_base64
......@@ -16,5 +16,5 @@ def str_to_python(string):
Reverse of the python_to_str() function.
"""
obj_string = base64.b64decode(string)
obj = cloudpickle.loads(obj_string)
obj = dill.loads(obj_string)
return obj
......@@ -2,7 +2,7 @@ from abc import ABC, abstractmethod
import base64
import os
import cloudpickle
import dill
import numpy as np
import h5py
......
......@@ -12,7 +12,7 @@ from setuptools import setup
setup(name='freeforestml',
version='0.0.0', # Also change in module
packages=["freeforestml", "freeforestml.tests"],
install_requires=["cloudpickle",
install_requires=["dill",
"h5py",
"numpy",
"matplotlib",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment