Skip to content

Commit

Permalink
Adding experimental wgit to the repo with wgit command (#991)
Browse files Browse the repository at this point in the history
* [feat] Adding wgit within fairscale/experimental/wgit.

* [feat] adding experimental wgit
  • Loading branch information
riohib committed May 25, 2022
1 parent 7510150 commit e14cca4
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions experimental/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
8 changes: 8 additions & 0 deletions experimental/wgit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from .cli import main

__version__ = "0.0.1"
9 changes: 9 additions & 0 deletions experimental/wgit/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from .cli import main

if __name__ == "__main__":
main()
23 changes: 23 additions & 0 deletions experimental/wgit/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import argparse


def main(argv=None):
desc = "WeiGit checkpoint tracking"
parser = argparse.ArgumentParser(description=desc)

# flags
parser.add_argument("-i", "--init", action="store_true", help="Initialize a weigit repository!")

args = parser.parse_args(argv)

if args.init:
print("Hello World, Wgit has been initialized!")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def find_version(version_file_path) -> str:
author_email="todo@fb.com",
long_description="FairScale is a PyTorch extension library for high performance and large scale training on one or multiple machines/nodes. This library extends basic PyTorch capabilities while adding new experimental ones.",
long_description_content_type="text/markdown",
entry_points={"console_scripts": ["wgit = experimental.wgit.__main__:main"]},
classifiers=[
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand Down
1 change: 1 addition & 0 deletions tests/ci_test_list_3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ tests/optim/test_oss_adascale.py
tests/optim/test_ddp_adascale.py
tests/experimental/nn/data_parallel/test_gossip.py
tests/nn/data_parallel/test_fsdp_hf_transformer_eval.py
tests/experimental/wgit/cli/test_cli.py
4 changes: 4 additions & 0 deletions tests/experimental/wgit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
4 changes: 4 additions & 0 deletions tests/experimental/wgit/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
13 changes: 13 additions & 0 deletions tests/experimental/wgit/cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import experimental.wgit.cli as cli


def test_cli_init(capsys):
cli.main(["--init"])
out, err = capsys.readouterr()
assert out == "Hello World, Wgit has been initialized!\n"
assert err == ""

0 comments on commit e14cca4

Please sign in to comment.