mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-12 07:38:04 +00:00
Allow to pverride pytorch lookup page: "agent.package_manager.torch_page / torch_nightly_page / torch_url_template_prefix"
This commit is contained in:
parent
a69766bd8b
commit
594ee5842e
@ -53,17 +53,16 @@ class PytorchWheel(object):
|
|||||||
python = attr.ib(type=str, converter=lambda x: str(x).replace(".", ""))
|
python = attr.ib(type=str, converter=lambda x: str(x).replace(".", ""))
|
||||||
torch_version = attr.ib(type=str, converter=fix_version)
|
torch_version = attr.ib(type=str, converter=fix_version)
|
||||||
|
|
||||||
url_template = (
|
url_template_prefix = "http://download.pytorch.org/whl/"
|
||||||
"http://download.pytorch.org/whl/"
|
url_template = "{0.cuda_version}/torch-{0.torch_version}" \
|
||||||
"{0.cuda_version}/torch-{0.torch_version}-cp{0.python}-cp{0.python}m{0.unicode}-{0.os_name}.whl"
|
"-cp{0.python}-cp{0.python}m{0.unicode}-{0.os_name}.whl"
|
||||||
)
|
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self.unicode = "u" if self.python.startswith("2") else ""
|
self.unicode = "u" if self.python.startswith("2") else ""
|
||||||
|
|
||||||
def make_url(self):
|
def make_url(self):
|
||||||
# type: () -> Text
|
# type: () -> Text
|
||||||
return self.url_template.format(self)
|
return (self.url_template_prefix + self.url_template).format(self)
|
||||||
|
|
||||||
|
|
||||||
class PytorchResolutionError(FatalSpecsResolutionError):
|
class PytorchResolutionError(FatalSpecsResolutionError):
|
||||||
@ -183,6 +182,19 @@ class PytorchRequirement(SimpleSubstitution):
|
|||||||
self._fix_setuptools = None
|
self._fix_setuptools = None
|
||||||
self.exceptions = []
|
self.exceptions = []
|
||||||
self._original_req = []
|
self._original_req = []
|
||||||
|
# allow override pytorch lookup pages
|
||||||
|
if self.config.get("agent.package_manager.torch_page", None):
|
||||||
|
SimplePytorchRequirement.page_lookup_template = \
|
||||||
|
self.config.get("agent.package_manager.torch_page", None)
|
||||||
|
if self.config.get("agent.package_manager.torch_nightly_page", None):
|
||||||
|
SimplePytorchRequirement.nightly_page_lookup_template = \
|
||||||
|
self.config.get("agent.package_manager.torch_nightly_page", None)
|
||||||
|
if self.config.get("agent.package_manager.torch_url_template_prefix", None):
|
||||||
|
PytorchWheel.url_template_prefix = \
|
||||||
|
self.config.get("agent.package_manager.torch_url_template_prefix", None)
|
||||||
|
if self.config.get("agent.package_manager.torch_url_template", None):
|
||||||
|
PytorchWheel.url_template = \
|
||||||
|
self.config.get("agent.package_manager.torch_url_template", None)
|
||||||
|
|
||||||
def _init_python_ver_cuda_ver(self):
|
def _init_python_ver_cuda_ver(self):
|
||||||
if self.cuda is None:
|
if self.cuda is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user