Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May I ask why ray remote can not send dict? #108

Open
lucasjinreal opened this issue Aug 26, 2022 · 1 comment
Open

May I ask why ray remote can not send dict? #108

lucasjinreal opened this issue Aug 26, 2022 · 1 comment

Comments

@lucasjinreal
Copy link

I have a gather Actor which takes all outputs of previous Actor:

@ray.remote
class GatherAll:

    def __init__(self) -> None:
        pass

    # def infer(self, hands, kpts):
    #     if hands.shape[0] > kpts.shape[0]:
    #         out = hands.copy()
    #         out[:kpts.shape[0], :] += kpts[..., :4]
    #         return out
    #     else:
    #         out = kpts.copy()[..., :4]
    #         out[:hands.shape[0], :] += hands
    #         return out

    def infer(self, datas):
        hands = datas['a']
        kpts = datas['b']
        if hands.shape[0] > kpts.shape[0]:
            out = hands.copy()
            out[:kpts.shape[0], :] += kpts[..., :4]
            return out
        else:
            out = kpts.copy()[..., :4]
            out[:hands.shape[0], :] += hands
            return out

the uncommented parts not work, which I call it in dict:

# out = G.infer.remote(hands, kpts)
out = G.infer.remote({'a': hands, 'b': kpts})

Get error:

AttributeError: 'ray._raylet.ObjectRef' object has no attribute 'shape'

Why using separated is OK, but dictionary is not ? Very confused here.

@lucasjinreal
Copy link
Author

There are plenty scenarios need sending dict since this is more flexible and can be scaled to any data pack. Otherwise in case I have 1000 outputs, I need send them 1000 function params? That is redicoules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant