Skip to content

Commit

Permalink
update PSI to support python 3.11 (#2972)
Browse files Browse the repository at this point in the history
* update PSI requirements.txt to support openmind-psi==2.0.4 which support python 3.11

* add comments
  • Loading branch information
chesterxgchen authored Oct 1, 2024
1 parent c0257c3 commit c6fc4a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
16 changes: 10 additions & 6 deletions examples/advanced/psi/user_email_match/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,22 @@ copy NVFlare/examples/advanced/psi/user_email_match/data to /tmp/nvflare/psi dir

**run job**
```
nvflare simulator -w /tmp/nvflare/psi -n 3 -t 3 user_email_match/jobs/user_email_match
nvflare simulator -w /tmp/nvflare/psi/job -n 3 -t 3 user_email_match/jobs/user_email_match
```
Once job completed and succeed, you should be able to find the intersection for different sites at

```
/tmp/nvflare/psi/simulate_job/site-1/psi/intersection.txt
/tmp/nvflare/psi/simulate_job/site-2/psi/intersection.txt
/tmp/nvflare/psi/simulate_job/site-3/psi/intersection.txt
/tmp/nvflare/psi/job/simulate_job/site-1/psi/intersection.txt
/tmp/nvflare/psi/job/simulate_job/site-2/psi/intersection.txt
/tmp/nvflare/psi/job/simulate_job/site-3/psi/intersection.txt
```
to compare these intersections, you can check with the followings:

```bash
diff <(sort /tmp/nvflare/psi/simulate_job/site-1/psi/intersection.txt) <(sort /tmp/nvflare/psi/simulate_job/site-2/psi/intersection.txt)
diff <(sort /tmp/nvflare/psi/simulate_job/site-2/psi/intersection.txt) <(sort /tmp/nvflare/psi/simulate_job/site-3/psi/intersection.txt)
diff <(sort /tmp/nvflare/psi/job/simulate_job/site-1/psi/intersection.txt) <(sort /tmp/nvflare/psi/job/simulate_job/site-2/psi/intersection.txt)
diff <(sort /tmp/nvflare/psi/job/simulate_job/site-2/psi/intersection.txt) <(sort /tmp/nvflare/psi/job/simulate_job/site-3/psi/intersection.txt)
```

**NOTE**
>>The PSI operator depends on openmind-psi. It now supports up-to-python 3.11
python 3.12 is still working in progress
3 changes: 1 addition & 2 deletions examples/advanced/psi/user_email_match/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
nvflare~=2.5.0rc
openmined.psi==1.1.1
openmined-psi==2.0.4
pandas
3 changes: 3 additions & 0 deletions nvflare/app_common/psi/dh_psi/dh_psi_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def parallel_backward_pass(self, ordered_clients: list, intersect_site: SiteSize
other_sites = [site for site in ordered_clients if site.name != intersect_site.name]
other_sites = self.get_updated_site_sizes(other_sites)

# todo: we might be able to skip these steps, simply broadcast the final intersection result directly
# todo: to all other sites, this avoid the backward pass of the intersection calculation

s = intersect_site
other_site_sizes = set([site.size for site in other_sites])
setup_msgs: Dict[str, str] = self.prepare_setup_messages(s, other_site_sizes)
Expand Down

0 comments on commit c6fc4a4

Please sign in to comment.