RUC-GSAI / YuLan-Rec

MIT License
287 stars 19 forks source link

_pickle.PicklingError: Can't pickle <class 'datetime.datetime'>: it's not the same object as datetime.datetime #16

Open fightingman1 opened 6 months ago

fightingman1 commented 6 months ago

Traceback (most recent call last): File "/home/worker/RS/YuLan-Rec-main/simulator.py", line 1312, in main() File "/home/worker/RS/YuLan-Rec-main/simulator.py", line 1308, in main recagent.save(os.path.join(config["simulator_dir"])) File "/home/worker/RS/YuLan-Rec-main/simulator.py", line 108, in save dill.dump(self.dict, f) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 250, in dump Pickler(file, protocol, *_kwds).dump(obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 418, in dump StockPickler.dump(self, obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 487, in dump self.save(obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1212, in save_module_dict StockPickler.save_dict(pickler, obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 971, in save_dict self._batch_setitems(obj.items()) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 997, in _batch_setitems save(v) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 603, in save self.save_reduce(obj=obj, rv) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 691, in save_reduce save(func) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1812, in save_type _save_with_postproc(pickler, (_create_type, ( File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1093, in _save_with_postproc pickler.save_reduce(*reduction, obj=obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 692, in save_reduce save(args) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 901, in save_tuple save(element) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1212, in save_module_dict StockPickler.save_dict(pickler, obj) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 971, in save_dict self._batch_setitems(obj.items()) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 997, in _batch_setitems save(v) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1465, in save_wrapper_descriptor pickler.save_reduce(_getattr, (obj.objclass, obj.name, File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 692, in save_reduce save(args) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 886, in save_tuple save(element) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 412, in save StockPickler.save(self, obj, save_persistent_id) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/site-packages/dill/_dill.py", line 1849, in save_type StockPickler.save_global(pickler, obj, name=obj_name) File "/home/worker/miniconda3/envs/RecAgent/lib/python3.9/pickle.py", line 1075, in save_global raise PicklingError( _pickle.PicklingError: Can't pickle <class 'datetime.datetime'>: it's not the same object as datetime.datetime

David-Hoa2023 commented 5 months ago

Same error. Please help.

Paitesanshi commented 5 months ago

@fightingman1 @David-Hoa2023 This error was caused by the mock implementation of datetime. We have resolved this issue. Please pull the latest commit from the main branch.