Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions #4

Open
hhdjl opened this issue Dec 11, 2023 · 8 comments
Open

Some questions #4

hhdjl opened this issue Dec 11, 2023 · 8 comments

Comments

@hhdjl
Copy link

hhdjl commented Dec 11, 2023

Sorry to bother you, but I'd like to ask why these two issues are occurring,I would appreciate it if you could answer it.
First one is
File "C:\Users\User\anaconda3\envs\gnn_model_stealing\lib\site-packages\torch\utils\data\dataloader.py", line 1004, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str)) from e
RuntimeError: DataLoader worker (pid(s) 26324, 3628, 32496, 24296, 32456, 23288, 31972, 22952) exited unexpectedly

Next one is
File "C:\Users\User\anaconda3\envs\gnn_model_stealing\lib\multiprocessing\spawn.py", line 135, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:

    if __name__ == '__main__':
        freeze_support()
        ...

The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
@xinleihe
Copy link
Owner

Hi,

sorry that I cannot reproduce the error message. Could you follow step 0 to reinstall the package again?

@hhdjl
Copy link
Author

hhdjl commented Dec 14, 2023

Sorry, I tried it as you instructed. I reset Anaconda, follow step 0 to create a virtual environment, he prompted me can't create, because I can't get down, as shown in the figure, so I tried to download it manually on the https://anaconda.org, but some packages only support linux, and I'm win, do you need to experiment on a linux virtual machine or have other solutions
Uploading 微信图片_20231214143015.png…

@xinleihe
Copy link
Owner

Hi, thanks for your feedback. However, the environment is only tested on Linux so we suggest you run on Linux too.

@hhdjl
Copy link
Author

hhdjl commented Dec 14, 2023

Thank you very much for your reply, I continue to experiment with Linux, if there is a result, I will let you know as soon as possible, it may take 2-3 days, thank you

@hhdjl
Copy link
Author

hhdjl commented Dec 28, 2023

Hello, when I try to perform the second type of attack, the n_neighbors<n_samples pops up, and when I try to locate it, I find that there is no kneighbors_graph of the function, what should I do

@xinleihe
Copy link
Owner

@hhdjl Could you specify the dataset and model you used to perform the attack? Please also share the command and error message so that we can better identify the error :)

@hhdjl
Copy link
Author

hhdjl commented Jan 6, 2024

(gnn_model_stealing) ubantu@ubantu-Z390-AORUS-PRO-WIFI:~/桌面/GNNStealing-master
/code$ python3 attack.py --dataset citeseer_full --target-model-dim 256 --num-hidden 256 --target-model gat --surrogate-model gin --recovery-from prediction --query_ratio 1.0 --structure idgl
Using backend: pytorch
/home/ubantu/anaconda3/envs/gnn_model_stealing/lib/python3.9/site-packages/dgl/backend/pytorch/tensor.py:40: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at /opt/conda/conda-bld/pytorch_1640811803361/work/torch/csrc/utils/tensor_new.cpp:201.)
return th.as_tensor(data, dtype=dtype)
Graph(num_nodes=4230, num_edges=14904,
ndata_schemes={'features': Scheme(shape=(602,), dtype=torch.float32), 'labels': Scheme(shape=(), dtype=torch.int64)}
edata_schemes={})
[ Using CUDA ]
[ Using KNN-graph as input graph: 24 ]
Traceback (most recent call last):
File "/home/ubantu/桌面/GNNStealing-master/code/attack.py", line 122, in
adj = idgl(config)
File "/home/ubantu/桌面/GNNStealing-master/code/attack.py", line 23, in idgl
model = ModelHandler(config)
File "/home/ubantu/桌面/GNNStealing-master/code/core/model_handler.py", line 63, in init
datasets = prepare_datasets(config)
File "/home/ubantu/桌面/GNNStealing-master/code/core/utils/data_utils.py", line 71, in prepare_datasets
adj, features, labels, idx_train, idx_val, idx_test = network_data_utils.load_dgl_graph(config['dgl_graph'],
File "/home/ubantu/桌面/GNNStealing-master/code/core/utils/network_data/data_utils.py", line 200, in load_dgl_graph
adj = kneighbors_graph(
File "/home/ubantu/anaconda3/envs/gnn_model_stealing/lib/python3.9/site-packages/sklearn/neighbors/_graph.py", line 125, in kneighbors_graph
return X.kneighbors_graph(X=query, n_neighbors=n_neighbors, mode=mode)
File "/home/ubantu/anaconda3/envs/gnn_model_stealing/lib/python3.9/site-packages/sklearn/neighbors/_base.py", line 881, in kneighbors_graph
A_ind = self.kneighbors(X, n_neighbors, return_distance=False)
File "/home/ubantu/anaconda3/envs/gnn_model_stealing/lib/python3.9/site-packages/sklearn/neighbors/_base.py", line 727, in kneighbors
raise ValueError(
ValueError: Expected n_neighbors <= n_samples, but n_samples = 9, n_neighbors = 24

@xinleihe
Copy link
Owner

xinleihe commented Jan 6, 2024

@hhdjl We cannot reproduce the error with this command: python3 attack.py --dataset citeseer_full --target-model-dim 256 --num-hidden 256 --target-model gat --surrogate-model gin --recovery-from prediction --query_ratio 1.0 --structure idgl.

Given the provided error message. It seems that one graph (e.g, train_g) only has 9 node features, which is less than 24. Could you also check how you partition your train/test graph?

To dive deeper into the error, you can check your features.shape in "/home/ubantu/桌面/GNNStealing-master/code/core/utils/network_data/data_utils.py", line 200, in load_dgl_graph adj = kneighbors_graph(...

For details of this function, you can also check: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.kneighbors_graph.html.

In our running, with the provided command of the attack, train_g has the features.shape of torch.Size([1269, 602]), which is 30% of all nodes (4230).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants