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

Improve bfloat16 serialization (backward compatible) #553

Merged
merged 7 commits into from
Feb 9, 2023

Conversation

justheuristic
Copy link
Member

@justheuristic justheuristic commented Feb 7, 2023

  • added bfloat16 serialization that sends 2 bytes per value (previously, we sent 4);
  • changed de-serialization code so it supports both modes of serialization.
  • the new mode can be enabled via export LEGACY_BFLOAT16=0
  • tested in pytorch 1.12 and 1.13

Next minor release: switch to new serialization mode
Next major release: remove legacy mode

@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #553 (90527a7) into master (39f6f81) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #553   +/-   ##
=======================================
  Coverage   75.93%   75.93%           
=======================================
  Files          81       81           
  Lines        7982     7995   +13     
=======================================
+ Hits         6061     6071   +10     
- Misses       1921     1924    +3     
Impacted Files Coverage Δ
hivemind/compression/base.py 94.44% <100.00%> (+1.22%) ⬆️
hivemind/moe/server/connection_handler.py 46.87% <0.00%> (-1.05%) ⬇️
hivemind/moe/server/runtime.py 69.16% <0.00%> (-0.84%) ⬇️
hivemind/moe/server/server.py 43.71% <0.00%> (-0.55%) ⬇️

@borzunov borzunov changed the title improve bfloat16 serialization (backward compatible) Improve bfloat16 serialization (backward compatible) Feb 9, 2023
@borzunov
Copy link
Member

borzunov commented Feb 9, 2023

I would suggest to:

  • Rename LEGACY_BFLOAT16 to USE_LEGACY_BFLOAT16 (both the env var and the constant), so that it's clear that it is a bool flag.
  • Remove the LEGACY_PYTORCH constant and use hasattr() instead, so we do not depend on knowing the exact version where these fields were renamed.

@justheuristic justheuristic merged commit 7d1bb7d into master Feb 9, 2023
@justheuristic justheuristic deleted the bfloat16-phase-1 branch February 9, 2023 12:54
mryab pushed a commit that referenced this pull request Feb 15, 2023
-    added bfloat16 serialization that sends 2 bytes per value (previously, we sent 4);
-    changed de-serialization code so it supports both modes of serialization.
-    the new mode can be enabled via export USE_LEGACY_BFLOAT16=0
-    tested in pytorch 1.12 and 1.13

---------

Co-authored-by: Aleksandr Borzunov <[email protected]>
(cherry picked from commit 7d1bb7d)
borzunov added a commit that referenced this pull request Mar 28, 2023
mryab pushed a commit that referenced this pull request Mar 31, 2023
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.

2 participants