SDCCA / DGL-PTM

The deep graph library implementation of the poverty trap model
GNU Lesser General Public License v2.1
0 stars 0 forks source link

randperm not consistent with set seed #117

Open vmgaribay opened 2 months ago

vmgaribay commented 2 months ago

I have noticed some small differences between reruns with the same seed. I am going to attempt to replace randperm with torch.rand(), which so far has not been a problem. Fingers crossed that this takes care of it.

vmgaribay commented 2 months ago

Other note, when I tried: gen = torch.Generator().set_state(torch.default_generator.get_state()) mask_edges = torch.randperm(upper_triangular.val.size()[0],generator=gen) < threshold It almost worked, but it oscillated between two arrangements. Not sure if that is a clue as to the deeper issue.

vmgaribay commented 2 months ago

initialization of the network and random_edge_noise appear not to be the problem. Search continues.

vmgaribay commented 2 months ago

the torch.randint in line 20 of local_attachment_basic_homophily.py is fine. However, torch.rand for prob_tensor is not always consistent.

vmgaribay commented 2 months ago

I have read on forums that this is an issue that may be due to the multithreading aspect of pytorch. I think I will give up. If anyone else has an idea, let me know.

vmgaribay commented 2 months ago

Yeah, I tried it (setting threads and restoring them after rand stuff) anyway, and as anticipated, so slow. Obviously not a solution.