I am attempting to load a model that I trained locally to QC Cloud, but am having some difficulties deserializing it. Following the instructions in the docs here, I am doing something like::
import pickle
import base64
# Stuff to be saved
MyClass:
def __init__(self):
pass
def foo(self):
return 1
myObj = MyClass()
myDat = {'a' : 1}
stuff = {'myObj' : myObj, 'myDat' : myDat }
# Serialize as string
stuff_serialized = pickle.dumps( stuff )
stuff_serialized = base64.b64encode( stuff_serialized ).decode('utf-8')
# Save to local ObjectStore
self.ObjectStore.Save('Stuff', stuff_serialized)
## Upload the file to Dropbox, then on QC Cloud:
# Download the file
stuff_serialized = self.Download('PATH_TO_FILE')
# Deserialize
stuff_serialized = base64.b64decode(stuff_serialized.encode('utf-8'))
stuff = pickle.loads(stuff_serialized)
But I am receiving the error in the pickle.loads step:
could not find MARK
Note that I'm using utf-8 instead of ascii as in the docs due to some invalid character errors.
Any suggestions?
Adam W
Not sure what the issue was but got it working:
Adam W
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!