# Ray sgd get\_model error

**URL:** <https://discuss.ray.io/t/ray-sgd-get-model-error/2437>\
**Category:** Ray Tune\
**Created:** [June 7, 2021, 2:29pm UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437 "2021-06-07T14:29:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asm582](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/asm582/32/669_2.png) [@asm582](https://discuss.ray.io/u/asm582)\
**Post date:** [June 7, 2021, 2:29pm UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437/1 "2021-06-07T14:29:48Z")

</div>

Hello,

I am running this example code on CPU on baremetal machine:

> <https://github.com/ray-project/ray/blob/master/python/ray/util/sgd/torch/examples/train_example.py>

I get the error:

Traceback (most recent call last):  
File “ray\_sgd\_example\_code.py”, line 146, in   
train\_example(num\_workers=args.num\_workers, use\_gpu=args.use\_gpu)  
File “ray\_sgd\_example\_code.py”, line 97, in train\_example  
m = trainer1.get\_model(to\_cpu=ray.util.client.ray.is\_connected())  
TypeError: get\_model() got an unexpected keyword argument ‘to\_cpu’

$ ray --version  
ray, version 1.3.0

Can you please help

---

<div class="post-metadata">

**Author:** ![asm582](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/asm582/32/669_2.png) [@asm582](https://discuss.ray.io/u/asm582)\
**Post date:** [June 7, 2021, 2:33pm UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437/2 "2021-06-07T14:33:47Z")

</div>

I had to comment out this line from the example to make it run on CPU:

#m = trainer1.get\_model(to\_cpu=ray.util.client.ray.is\_connected())

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [June 8, 2021, 9:17am UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437/3 "2021-06-08T09:17:25Z")

</div>

cc @amogkam could you help him?

---

<div class="post-metadata">

**Author:** ![amogkam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/amogkam/32/17_2.png) [@amogkam](https://discuss.ray.io/u/amogkam)\
**Post date:** [June 8, 2021, 4:40pm UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437/4 "2021-06-08T16:40:16Z")

</div>

Hey @asm582 if you’re using Ray 1.3 can you make sure to use the examples in the releases/1.3.0 branch.

If you want to use the examples on master branch, they will work if you upgrade to the nightly Ray.

---

<div class="post-metadata">

**Author:** ![asm582](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/asm582/32/669_2.png) [@asm582](https://discuss.ray.io/u/asm582)\
**Post date:** [June 8, 2021, 4:42pm UTC](https://discuss.ray.io/t/ray-sgd-get-model-error/2437/5 "2021-06-08T16:42:47Z")

</div>

Thank you @amogkam , I was indeed running examples from the master branch and it seems like they are not backward complatible.
