run-ai / genv

GPU environment and cluster management with LLM support
https://www.genv.dev
GNU Affero General Public License v3.0
445 stars 19 forks source link

gev.ray.remote does not work on classes #53

Open EkinKarabulut opened 10 months ago

EkinKarabulut commented 10 months ago

@genv.ray.remote does not work on classes but only on methods.

When it is used before the functions, it works:

@genv.ray.remote(num_gpus=1)
def train(): 

But when it is used with classes;

@genv.ray.remote(num_gpus=1)
class Trainer:
    def train(self):

it throws the following error:

2023-07-21 08:44:38,183 INFO worker.py:1636 -- Started a local Ray instance.
Traceback (most recent call last):
  File "/home/ekinkarabulut/genv/ray_genv.py", line 105, in <module>
    main_task = trainer.train.remote()
                ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ray._raylet.ObjectRef' object has no attribute 'train'