mitmul / deeppose

DeepPose implementation in Chainer
http://static.googleusercontent.com/media/research.google.com/ja//pubs/archive/42237.pdf
GNU General Public License v2.0
408 stars 129 forks source link

CHAINER_SEED type error #12

Closed TheTesla closed 8 years ago

TheTesla commented 8 years ago

running: python scripts/train.py gives: willi@Graphi1k14:~/deeppose$ python scripts/train.py Traceback (most recent call last): File "scripts/train.py", line 206, in os.environ['CHAINER_SEED'] = args.seed File "/usr/lib/python2.7/os.py", line 471, in setitem putenv(key, item) TypeError: must be string, not int

if I run: python scripts/train.py --seed foo it gives me: train.py: error: argument --seed: invalid int value: 'foo'

if I run: python scripts/train.py --seed 42 gives the same like the first try (without --seed argument)

It seems to work if I comment out the line: os.environ['CHAINER_SEED'] = args.seed

mitmul commented 8 years ago

Thank you for reporting the bug. I completely misunderstood about the way to set environment variables. Because if I set those variables after loading chainer modules, they have no effect. So I deleted the lines to set environment variables from train.py. If you want to set CHAINER_SEED and CHAINER_TYPE_CHECK, please give the values you want to use for those variables when you run this script on the terminal. like:

$ CHAINER_SEED=2016 CHAINER_TYPE_CHECK=0 python scripts/train.py

I think this issue ( https://github.com/pfnet/chainer/issues/897 ) by @karunaahuja is talking about this problem. @karunaahuja, if you are facing at this problem, please pull the newest commit of this repo and try the above solution.

delta2323 commented 8 years ago

I am not confident I understand what you really want to do, but if you would like to fix the random seed within the training script, you can do that by calling cupy.random.seed(). It sets the random seed used in the current device.