Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update base for Update on "[BE][SparseAdam] cleaner way to verify no …
…sparse params" Context: #47724 fixed the problem that SparseAdam could not handle generators by using the `list(...)` construct. However, this meant that SparseAdam deviated from other optimizers in that it could _accept_ a raw Tensors/Parameter vs requiring a container of them. This is not really a big deal. So why this PR? I do think this PR is cleaner. It uses the fact that the Optimizer parent class already containerizes parameters into parameter groups, so we could reuse that here by calling `super().__init__` first and then filter the param_groups after. This change would also make SparseAdam consistent with the rest of our optimizers in that only containerized params are accepted, which technically is BC breaking but would be minor, I believe. [ghstack-poisoned]
- Loading branch information
Showing
370 changed files
with
15,007 additions
and
4,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9682172576d5d9a10f3162ad91e0a32b384a3b7c | ||
5159de436ced71c78bc1c22e3c1d93654c429227 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e8a35b3968780e48df1374482d56cc6cdbb9e351 | ||
dafe1459823b9549417ed95e9720f1b594fab329 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
a8f4e97bd5356a7a77510cdf6a3a62e25a5dc602 | ||
db624844f5c95bb7618fe5a5f532bf9b68efeb45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4433680aa57439ed684f9854fac3443b76e03c03 | ||
893b4abdc0c9df36c241c58769810f69e35dab48 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import argparse | ||
import subprocess | ||
from typing import Dict | ||
|
||
import generate_binary_build_matrix | ||
|
||
|
||
def tag_image( | ||
image: str, | ||
default_tag: str, | ||
release_version: str, | ||
dry_run: str, | ||
tagged_images: Dict[str, bool], | ||
) -> None: | ||
if image in tagged_images: | ||
return | ||
release_image = image.replace(f"-{default_tag}", f"-{release_version}") | ||
print(f"Tagging {image} to {release_image} , dry_run: {dry_run}") | ||
|
||
if dry_run == "disabled": | ||
subprocess.check_call(["docker", "pull", image]) | ||
subprocess.check_call(["docker", "tag", image, release_image]) | ||
subprocess.check_call(["docker", "push", release_image]) | ||
tagged_images[image] = True | ||
|
||
|
||
def main() -> None: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--version", | ||
help="Version to tag", | ||
type=str, | ||
default="2.2", | ||
) | ||
parser.add_argument( | ||
"--dry-run", | ||
help="No Runtime Error check", | ||
type=str, | ||
choices=["enabled", "disabled"], | ||
default="enabled", | ||
) | ||
|
||
options = parser.parse_args() | ||
tagged_images: Dict[str, bool] = dict() | ||
platform_images = [ | ||
generate_binary_build_matrix.WHEEL_CONTAINER_IMAGES, | ||
generate_binary_build_matrix.LIBTORCH_CONTAINER_IMAGES, | ||
generate_binary_build_matrix.CONDA_CONTAINER_IMAGES, | ||
] | ||
default_tag = generate_binary_build_matrix.DEFAULT_TAG | ||
|
||
for platform_image in platform_images: # type: ignore[attr-defined] | ||
for arch in platform_image.keys(): # type: ignore[attr-defined] | ||
tag_image( | ||
platform_image[arch], # type: ignore[index] | ||
default_tag, | ||
options.version, | ||
options.dry_run, | ||
tagged_images, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.