ProGamerGov / neural-style-pt

PyTorch implementation of neural style transfer algorithm
MIT License
833 stars 178 forks source link

Print seed used? #86

Closed Feez closed 3 years ago

Feez commented 3 years ago

Could it be added to print the seed used? Useful for when want to reproduce the result of a random seed after-the-fact

I believe it is as simple as

print(f"Seed used: {torch.seed()}")

But I not familiar enough with Torch or ML libraries in general to know if this is the correct seed and/or if there are side effects to this.

ProGamerGov commented 3 years ago

@Feez I tried doing that a while back and it didn't seem to work. Though maybe things have changed since then?

It may be easier to use something like randint: https://docs.python.org/3/library/random.html#functions-for-integers

import random
min, max = 0, 9999999
seed = random.randint(min, max)
print(seed)
params.seed = seed