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

Add IPFS integration #35

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

Vectorrent
Copy link

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

Implements the use_ipfs argument, as documented here.

IPFS nodes will not respond to ping in the way Hivemind expects, so we also set ensure_bootstrap_success to False, when IPFS is used. Nevertheless, HivemindStrategy will connect to peers successfully once training begins.

Also added the bootstrap_timeout and wait_timeout arguments. Because the initial_peers format for IPFS omits the IP address (/p2p/XYZ123...), we need to set these higher, to allow IPFS time to connect. Else, 90% of attempts to join an IPFS-bootstrapped swarm will fail.

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #35 (cb87106) into main (0835ea0) will not change coverage.
Report is 2 commits behind head on main.
The diff coverage is n/a.

Additional details and impacted files
@@        Coverage Diff         @@
##           main   #35   +/-   ##
==================================
  Coverage    86%   86%           
==================================
  Files         3     3           
  Lines       167   167           
==================================
  Hits        144   144           
  Misses       23    23           

@Vectorrent Vectorrent mentioned this pull request Dec 15, 2023
4 tasks
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

Looks good, can you please add test for it..

@Vectorrent
Copy link
Author

I'm not really sure how to write a proper test here. I setup the IPFS settings to just use the same defaults as Hivemind itself, so by default - nothing has changed. I would have written a full test for multiple peers over the IPFS network - but the existing one is marked as @pytest.mark.skip(); and so, I don't have a functional example to even start with.

Anyway, I also couldn't get this project to install on Arch Linux (failures with grpcio-tools), so I had to use a Docker environment for the testing. You can build the image with docker compose build and you can run tests with docker compose up.

I also added a couple more relevant settings. use_auto_relay=True is extremely helpful in connecting peers across the Internet.

@Vectorrent
Copy link
Author

I also updated Hivemind to its latest version. It seems to be passing all tests, and it's working well in my limited production testing.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@Borda Borda requested review from Borda and justusschock April 2, 2024 07:27
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.

None yet

2 participants