QSong-github / SiGra

Single-cell spatial elucidation through image-augmented graph transformer
MIT License
28 stars 6 forks source link

The setting of .val_mask data for data.x[data.val_mask] is not explicitly shown in the code. #4

Open 12hsk opened 1 month ago

12hsk commented 1 month ago

Traceback (most recent call last): File "F:/SiGra-main/SiGra_model/train.py", line 32, in train_10x(opt) File "F:\SiGra-main\SiGra_model\train_visium.py", line 237, in train_10x ARI = train(opt, i) File "F:\SiGra-main\SiGra_model\train_visium.py", line 199, in train adata = train_img(adata, hidden_dims=[512, 30], n_epochs=opt.epochs, save_loss=True, File "F:\SiGra-main\SiGra_model\train_transformer.py", line 1322, in train_img gloss = F.mse_loss(data.x[data.val_mask], gout[data.val_mask]) File "E:\anaconda\envs\SiGra\lib\site-packages\torch_geometric\data\data.py", line 559, in getattr return getattr(self._store, key) File "E:\anaconda\envs\SiGra\lib\site-packages\torch_geometric\data\storage.py", line 96, in getattr raise AttributeError( AttributeError: 'GlobalStorage' object has no attribute 'val_mask' Data(x=[4226, 3000], edge_index=[2, 24770])

进程已结束,退出代码1

keyalone commented 2 weeks ago

I encountered a similar issue while running the train_img function, and it seems to be related to the version of torch_geometric. Although I tried various versions of torch_geometric, the problem persisted. Interestingly, the function works when applying SiGra on the entire DLPFC dataset, but the issue arises when applying SiGra to other datasets.

Therefore, I commented out the code in train_transformer.py because I believe that the train_img function is intended to work exclusively with the DLPFC dataset, which contains Ground Truth, as shown in the picture.

SiGra is an excellent method for spatial domain analysis. Could the authors provide a tutorial on how to apply SiGra to the 10x dataset that lacks manual annotation?

微信图片_20240717161725