-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
adjust versions #6363
Merged
Merged
adjust versions #6363
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e2ea35f
adjust versions
Borda e68572a
release
Borda dda4fb1
manifest
Borda 73b0647
pep8
Borda 8828f2e
.
Borda 268c4c7
..
Borda 20f37fc
..
Borda 986ecf4
push
Borda 9f6766b
CI
Borda 09a104e
fix
Borda 788fac3
fix
Borda df8886f
build
Borda 3007ad9
pull
Borda bb9d142
.
Borda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,49 @@ | ||||||
import os | ||||||
import re | ||||||
import sys | ||||||
from typing import Any, Dict | ||||||
|
||||||
VERSIONS_LUT: Dict[str, Dict[str, Any]] = { | ||||||
"1.4.0": dict(torchvision="0.5.0", torchtext="0.5"), | ||||||
"1.5.0": dict(torchvision="0.6.0", torchtext="0.6"), | ||||||
"1.5.1": dict(torchvision="0.6.1", torchtext="0.6"), | ||||||
"1.6.0": dict(torchvision="0.7.0", torchtext="0.7"), | ||||||
"1.7.0": dict(torchvision="0.8.1", torchtext="0.8"), | ||||||
"1.7.1": dict(torchvision="0.8.2", torchtext="0.8.1"), | ||||||
"1.8.0": dict(torchvision="0.9.0", torchtext="0.9"), | ||||||
} | ||||||
|
||||||
|
||||||
def find_latest(ver: str, versions_all: list) -> str: | ||||||
# drop all except semantic version | ||||||
ver = re.search(r'([\.\d]+)', ver).groups()[0] | ||||||
# find candidates, by starting version pattern | ||||||
options = [v for v in versions_all if v.startswith(ver)] | ||||||
assert options, f"missing {ver} among {versions_all}" | ||||||
# take the last one... | ||||||
return sorted(options)[-1] | ||||||
|
||||||
|
||||||
def main(path_req: str, torch_version: str = None) -> None: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
with open(path_req, "r") as fp: | ||||||
req = fp.read() | ||||||
|
||||||
if not torch_version: | ||||||
import torch | ||||||
torch_version = torch.__version__ | ||||||
assert torch_version, f"invalid/missing Torch: {torch_version}" | ||||||
|
||||||
torch_version = find_latest(torch_version, list(VERSIONS_LUT.keys())) | ||||||
dep_versions = VERSIONS_LUT[torch_version] | ||||||
dep_versions["torch"] = torch_version | ||||||
for lib in dep_versions: | ||||||
version = dep_versions[lib] | ||||||
replace = f"{lib}=={version}\n" | ||||||
req = re.sub(rf"{lib}[>=]*[\d\.]*{os.linesep}", replace, req) | ||||||
|
||||||
with open(path_req, "w") as fp: | ||||||
fp.write(req) | ||||||
|
||||||
|
||||||
if __name__ == "__main__": | ||||||
main(*sys.argv[1:]) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.