dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.38k stars 3k forks source link

AttributeError: 'Column' object has no attribute `deferred_dtype` #4107

Closed mufeili closed 2 years ago

mufeili commented 2 years ago

🐛 Bug

@ndickson-nvidia @BarclayII

The introduction of deferred_dtype in PR #3890 seems to be causing issues when loading a graph file saved with an older version of DGL. Do you have any ideas on fixing the compatibility? We might also want to add a unit test for loading a graph data file saved with an older version of DGL.

WechatIMG8012

Expected behavior

Environment

nv-dlasalle commented 2 years ago

Do we see the same issue for pinned_by_dgl as well? Or do we have an established method for handling new attributes?

ndickson-nvidia commented 2 years ago

Are there any plans to add a more robust system for saving/loading graph data? Relying on just serializing Python objects, like what dgl.data.utils.save_info and dgl.data.utils.load_info do, seems like a risky approach that may not be able to support any sort of compatibility, especially since there's no version information. I'd expect that a few data members of Column, for example, never need to be saved or loaded, since device, index, and deferred_dtype should be resolved and cleared before saving to disk, and there are probably other similar examples in other classes.

LQ999666 commented 2 years ago

博主,您这个问题怎么解决的

LQ999666 commented 2 years ago

Blogger, how did you solve this problem

mufeili commented 2 years ago

Blogger, how did you solve this problem

For now, downgrading to 0.8.1 should address the issue.

LQ999666 commented 2 years ago

thank you ,my problem has solved.

natalie-0430 commented 2 years ago

Hello, how can you downgrade to 0.8.1 from 0.8.2? I have a similar problem.

nv-dlasalle commented 2 years ago

@natalie-0430 That will depend on how you installed it. If you used pip for example:

pip uninstall dgl-cu113
pip install dgl-cu113==0.8.1 dglgo -f https://data.dgl.ai/wheels/repo.html

@mufeili What's your preferred fix for this? Should we add hasattr to check if the unpickled object has the new attribute, or should we override __setstate__ (https://docs.python.org/3/library/pickle.html#object.__setstate__) to explicitly populate missing attributes from old versions?

mufeili commented 2 years ago

@natalie-0430 That will depend on how you installed it. If you used pip for example:

pip uninstall dgl-cu113
pip install dgl-cu113==0.8.1 dglgo -f https://data.dgl.ai/wheels/repo.html

@mufeili What's your preferred fix for this? Should we add hasattr to check if the unpickled object has the new attribute, or should we override __setstate__ (https://docs.python.org/3/library/pickle.html#object.__setstate__) to explicitly populate missing attributes from old versions?

@jermainewang @BarclayII What do you think? Probably overriding __setstate__ will be more general for future changes?

jermainewang commented 2 years ago

I vote for overriding __setstate__ and __getstate__. Two other related questions: