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

determinism problem #41

Closed
xuuuluuu opened this issue Jun 21, 2019 · 3 comments
Closed

determinism problem #41

xuuuluuu opened this issue Jun 21, 2019 · 3 comments

Comments

@xuuuluuu
Copy link

Hi Kipf,

Nice work. I am trying to run the model but failed to get the same result everytime even with the below lines.

np.random.seed(args.seed)
torch.manual_seed(args.seed)
if args.cuda:
torch.cuda.manual_seed(args.seed)

@ChrisZhangcx
Copy link

I met with the same problem. Did you figure out how to solve this?

@ChrisZhangcx
Copy link

It turns out to me that the set() method in utils.py line 7 contributes to this issue.
Cuz every time we transform a list into a set, the order will be different.
There are two methods to solve this:

  1. Change set to hashset.
  2. Replace origin line 7 with 'classes = sorted(set(labels))'.

I utilized the second method and this problem have been solved. Please check this out.

@xuuuluuu
Copy link
Author

It turns out to me that the set() method in utils.py line 7 contributes to this issue.
Cuz every time we transform a list into a set, the order will be different.
There are two methods to solve this:

  1. Change set to hashset.
  2. Replace origin line 7 with 'classes = sorted(set(labels))'.

I utilized the second method and this problem have been solved. Please check this out.

I think you are right. the set is not ordered by default.

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