Closed JunsuAndrewLee closed 4 months ago
Hi @JunsuAndrewLee, you should add your model class in the load_check_point like that
model = M3GNet(input_args) my_lit_module = PotentialLightningModule.load_from_checkpoint("PATH_TO_CHECKPOINT", model=model)
This should work and please let me know if any questions
Using the method you described I get a different error now (this checkpoint is still from version 0.9.2 I tried to load it both with the original as well as a newer version, dgl was 1.1.3). Any idea?:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/pytorch_lightning/core/module.py", line 1531, in load_from_checkpoint
loaded = _load_from_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/pytorch_lightning/core/saving.py", line 60, in _load_from_checkpoint
checkpoint = pl_load(checkpoint_path, map_location=map_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/lightning_fabric/utilities/cloud_io.py", line 51, in _load
return torch.load(f, map_location=map_location) # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/serialization.py", line 809, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/serialization.py", line 1172, in _load
result = unpickler.load()
^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/pickle.py", line 1213, in load
dispatch[key[0]](self)
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/pickle.py", line 1254, in load_binpersid
self.append(self.persistent_load(pid))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/serialization.py", line 1142, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/serialization.py", line 1116, in load_tensor
wrap_storage=restore_location(storage, location),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/serialization.py", line 1089, in restore_location
result = map_location(storage, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/apps/nss/gcc-8.2.0/python/3.11.2/x86_64/lib64/python3.11/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/sjonathan/dgl/lib64/python3.11/site-packages/matgl/models/_m3gnet.py", line 236, in forward
node_types = g.ndata["node_type"]
^^^^^^^
AttributeError: 'torch.storage.UntypedStorage' object has no attribute 'ndata'. Did you mean: '_cdata'?
@kenko911 I am also interested in a follow-up to @JonathanSchmidt1 's comment
Email (Optional)
No response
Version
1.0.0
Which OS(es) are you using?
What happened?
Please let me know if any mistake I have made. Thank you!
Code snippet
Log output
Code of Conduct