ChenJY-Count / PolyGCL

PyTorch implementation of "PolyGCL: GRAPH CONTRASTIVE LEARNING via Learnable Spectral Polynomial Filters"
8 stars 1 forks source link

i run sh exp_PolyGCL.sh , and i found this type of error. so please help me. #1

Open rajnish159 opened 2 months ago

rajnish159 commented 2 months ago

i run sh exp_PolyGCL.sh , and i found this type of error. so please help me.

Traceback (most recent call last): File "training.py", line 15, in from model import LogReg,Model File "/DATA/chatterjee2/PolyGCL/model.py", line 3, in from torch_geometric.nn.conv.gcn_conv import gcn_norm File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_geometric/init.py", line 5, in import torch_geometric.data File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_geometric/data/init.py", line 1, in from .data import Data File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_geometric/data/data.py", line 8, in from torch_sparse import coalesce, SparseTensor File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_sparse/init.py", line 40, in from .tensor import SparseTensor # noqa File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_sparse/tensor.py", line 13, in class SparseTensor(object): File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch/jit/_script.py", line 1302, in script _compile_and_register_class(obj, _rcb, qualified_name) File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch/jit/_recursive.py", line 44, in _compile_and_register_class script_class = torch._C._jit_script_class_compile(qualified_name, ast, defaults, rcb) RuntimeError: object has no attribute sparse_csc_tensor: File "/DATA/chatterjee2/anaconda3/envs/rajnish/lib/python3.8/site-packages/torch_sparse/tensor.py", line 585 value = torch.ones(self.nnz(), dtype=dtype, device=self.device()) return torch.sparse_csc_tensor(colptr, row, value, self.sizes()) ~~~~~~~ <--- HERE

ChenJY-Count commented 2 months ago

The error message you're encountering seems to be related to a compatibility issue between PyTorch and the torch_sparse library, which is part of the torch-geometric package. Here's a breakdown of the key points from the error message and potential steps to resolve the issue:

  1. Error Source: The error occurs when trying to use torch.sparse_csc_tensor which is being called in the torch_sparse library but is not recognized as an attribute of the torch library in your current environment.

  2. Potential Cause: The version of PyTorch installed in your environment might not support torch.sparse_csc_tensor. This function is relatively new and is available in more recent versions of PyTorch.

  3. Resolution Steps:

    • Update PyTorch: Make sure that you are using a version of PyTorch that supports CSC (Compressed Sparse Column) tensor format. This feature is available in PyTorch versions 1.8 and later. You can update PyTorch using the following command:
      conda activate rajnish
      conda install pytorch=1.11.0 torchvision torchaudio cudatoolkit=11.3 -c pytorch
    • Check Compatibility: Ensure that all the packages, especially those related to PyTorch Geometric (torch_geometric, torch_sparse, etc.), are compatible with each other and with the version of PyTorch you are using. You may need to update these packages as well:
      conda install torch-geometric=1.7.2 -c rusty1s -c conda-forge
    • Verify Environment: Sometimes, Python environments can get mixed up, especially if multiple versions of libraries are installed. Ensure that the correct environment is active and the correct paths are being used by Python.
  4. General Advice: After updating, verify the installation and the availability of torch.sparse_csc_tensor by trying to import it directly in a Python shell:

    import torch
    print(dir(torch.sparse))  # Check if 'csc_tensor' is listed

These steps should help you resolve the issue. If the problem persists even after updating, there might be additional compatibility issues or installation errors that need to be addressed.

rajnish159 commented 2 months ago

now i got this type of error:-

FileNotFoundError: [Errno 2] No such file or directory: 'pkl/best_model_cora1715767549.pkl'

ChenJY-Count commented 2 months ago

now i got this type of error:-

FileNotFoundError: [Errno 2] No such file or directory: 'pkl/best_model_cora1715767549.pkl'

You just need to create a new folder named 'pkl' in the current directory to resolve this, and run the following command in the terminal.

     mkdir pkl