qitianwu / NodeFormer

The official implementation of NeurIPS22 spotlight paper "NodeFormer: A Scalable Graph Structure Learning Transformer for Node Classification"
291 stars 28 forks source link

Runtime error when running main-batch.py #22

Closed vickychen928 closed 4 months ago

vickychen928 commented 4 months ago

When running the following command with the amazon2m dataset:

python main-batch.py --dataset amazon2m --rand_split --metric acc --method nodeformer  --lr 1e-2 --weight_decay 0. --num_layers 3 --hidden_channels 64 --num_heads 1 --rb_order 1 --rb_trans identity --lamda 0.01 --M 50 --K 5 --use_bn --use_residual --use_gumbel --use_act --use_jk --batch_size 100000 --runs 5 --epochs 1000 --eval_step 9 --device 0

I encountered the following runtime error:

Traceback (most recent call last):
  File "/home/s111062588/NodeFormer/main-batch.py", line 136, in <module>
    x_i = x[idx_i].to(device)
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

Could you please explain why this error occurred and how to resolve it? Thank you!