hclhkbu / dlbench

Benchmarking State-of-the-Art Deep Learning Software Tools
http://dlbench.comp.hkbu.edu.hk/
MIT License
170 stars 47 forks source link

Compatibility with TF 1.0 #3

Closed yaroslavvb closed 7 years ago

yaroslavvb commented 7 years ago

This fixes some obvious API changes. It doesn't quite work (crashes with error below), so some digging needs to be done to see why it can't find the variable name. Hopefully this can be used as starting point for someone upgrading it to run under TF 1.0

  File "resnet_cifar10_multi_gpu.py", line 174, in <module>
    tf.app.run()
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "resnet_cifar10_multi_gpu.py", line 170, in main
    train()
  File "resnet_cifar10_multi_gpu.py", line 118, in train
    apply_gradient_op = optimizer.apply_gradients(grads, global_step=global_step)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 409, in apply_gradients
    self._create_slots(var_list)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/momentum.py", line 55, in _create_slots
    self._zeros_slot(v, "momentum", self._name)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 609, in _zeros_slot
    named_slots[var] = slot_creator.create_zeros_slot(var, op_name)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/slot_creator.py", line 123, in create_zeros_slot
    colocate_with_primary=colocate_with_primary)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/slot_creator.py", line 101, in create_slot
    return _create_slot_var(primary, val, '')
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/training/slot_creator.py", line 55, in _create_slot_var
    slot = variable_scope.get_variable(scope, initializer=val, trainable=False)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 988, in get_variable
    custom_getter=custom_getter)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 890, in get_variable
    custom_getter=custom_getter)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 348, in get_variable
    validate_shape=validate_shape)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter
    caching_device=caching_device, validate_shape=validate_shape)
  File "/home/yaroslav/.conda/envs/tim-jan17/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 657, in _get_single_variable
    "VarScope?" % name)
ValueError: Variable scale1/weights/Momentum/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?
yaroslavvb commented 7 years ago

OK with help of @annarev I was able to find the last remaining issue, this PR now makes things compatible with latest TF version