Skip to content

Plans for CrypTen#3165

Closed
gmuraru wants to merge 2 commits intoOpenMined:pytorch/cryptenfrom
gmuraru:gm-crypten-plans
Closed

Plans for CrypTen#3165
gmuraru wants to merge 2 commits intoOpenMined:pytorch/cryptenfrom
gmuraru:gm-crypten-plans

Conversation

@gmuraru
Copy link
Member

@gmuraru gmuraru commented Mar 9, 2020

No description provided.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@gmuraru gmuraru force-pushed the gm-crypten-plans branch 2 times, most recently from e223ba8 to ea46f10 Compare March 9, 2020 09:16
@gmuraru gmuraru requested review from LaRiffle and youben11 and removed request for LaRiffle March 9, 2020 09:16
@gmuraru gmuraru assigned LaRiffle and unassigned LaRiffle Mar 9, 2020
@gmuraru gmuraru requested review from LaRiffle and ajnovice March 9, 2020 09:16
return location._recv_msg(message)

def _recv_msg(self, message: bin) -> bin:
"""receive message"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaRiffle this one and the one below are the fixes for the issues you observed

@gmuraru gmuraru force-pushed the gm-crypten-plans branch from ea46f10 to 03403e5 Compare March 9, 2020 10:21
@gmuraru gmuraru closed this Mar 9, 2020
@gmuraru gmuraru force-pushed the gm-crypten-plans branch from 03403e5 to bb784d7 Compare March 9, 2020 10:34
@gmuraru gmuraru reopened this Mar 9, 2020
@gmuraru gmuraru force-pushed the gm-crypten-plans branch 2 times, most recently from 20b39ac to 40baab0 Compare March 9, 2020 11:21


def load(tag: str, src: int, id_worker: int):
def load(tag: str, src: int, id_worker: int, size: tuple):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not know the size of loaded tensors so we shouldn't have size as a required parameter, instead, it should be optional, and we either exchange messages in case size is not provided, or doesn't exchange messages at all if it's not.

response = eval(cmd)(*args, **kwargs) # nosec
else:
if isinstance(_self.child, crypten.mpc.MPCTensor):
if isinstance(_self.child, crypten.mpc.MPCTensor):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

response = getattr(_self, cmd)(*args, **kwargs)
return_placeholder.instantiate(response.child)

if "child" in dir(response):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use hasattr instead?

try:
response = func(*args, **kwargs)
except Exception as e:
response = th.rand(kwargs["size"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to run the function? I mean is it required or it could just be always a random response ?

try:
import crypten
except e:
print("CrypTen not found")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use the same strategy than for the imports or PT & TF (but this is not important)


native_func = getattr(crypten, "load")
setattr(crypten, "native_load", native_func)
setattr(crypten, "load", crypten_load)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed I guess

"""
Operates as a router for functions. A function call always starts
by being handled here and 3 scenarii must be considered:
by being handled here and 3 scenarios must be considered:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scenarii is ok - it's when you want to look as a star, you put the italian plural for works that have italian origins

return_value = run_party(toy_func, rank, world_size, master_addr, master_port, (), {})

plan = None
for key, val in self._objects.items():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using tags to retrieve the plan?

if isinstance(response, crypten.mpc.MPCTensor):
return response

response.parents = (self.id, new_self.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the role of those 3 lines for the moment!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed them

@gmuraru gmuraru changed the title Crypten Plans [WIP] Crypten Plans Mar 19, 2020
@karlhigley karlhigley requested a review from a team March 23, 2020 14:46
@gmuraru gmuraru changed the title [WIP] Crypten Plans Plans for CrypTen Mar 25, 2020
Signed-off-by: George Muraru <murarugeorgec@gmail.com>
@gmuraru
Copy link
Member Author

gmuraru commented Mar 27, 2020

Moved here #3254 so will close this one.

@gmuraru gmuraru closed this Mar 27, 2020
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

Successfully merging this pull request may close these issues.

4 participants