• Home
  • Raw
  • Download

Lines Matching +full:repo +full:- +full:token

1 # mypy: allow-untyped-defs
25 class _Faketqdm: # type: ignore[no-redef]
78 # matches bfd8deac from resnet18-bfd8deac.pth
79 HASH_REGEX = re.compile(r"-([a-f0-9]*)\.")
128 # See https://docs.github.com/en/rest/reference/repos#download-a-repository-archive-zip
179 f"repo could not be found in the cache ({get_dir()})"
186 return r.read().decode(r.headers.get_content_charset("utf-8"))
192 token = os.environ.get(ENV_GITHUB_TOKEN)
193 if token is not None:
194 headers["Authorization"] = f"token {token}"
213 "If it's a commit from a forked repo, please call hub.load() with forked repo directly."
228 # Parse github repo information
235 # Github renames folder repo-v1.x.x to repo-1.x.x
236 # We don't know the repo name before downloading the zip file
238 # To check if cached repo exists, we need to normalize folder names.
241 # Check that the repo is in the trusted list
256 # Validate the tag/branch is from the original repo instead of a forked repo
270 … # in the repo. This can be disambiguated by explicitely using refs/heads/ or refs/tags
271 # See https://git-scm.com/book/en/v2/Git-Internals-Git-References
274 … f"The ref {ref} is ambiguous. Perhaps it is both a tag and a branch in the repo? "
296 shutil.move(extracted_repo, repo_dir) # rename the repo
317 …# if a repo was already downloaded by torchhub, then it is already trusted (even if it's not in th…
336 … f"confirmation if the repo is not already trusted. This will eventually be the default behaviour"
353 # At this point we're sure that the user trusts the repo (or wants to trust it)
430 List all callable entrypoints available in the repo specified by ``github``.
440 specified by the ``github`` argument properly belongs to the repo owner. This will make
441 requests to the GitHub API; you can specify a non-default GitHub token by setting the
447 - If ``False``, a prompt will ask the user whether the repo should
449 - If ``True``, the repo will be added to the trusted list and loaded
451 - If ``"check"``, the repo will be checked against the list of
454 - If ``None``: this will raise a warning, inviting the user to set
503 model (str): a string of entrypoint name defined in repo's ``hubconf.py``
507 specified by the ``github`` argument properly belongs to the repo owner. This will make
508 requests to the GitHub API; you can specify a non-default GitHub token by setting the
514 - If ``False``, a prompt will ask the user whether the repo should
516 - If ``True``, the repo will be added to the trusted list and loaded
518 - If ``"check"``, the repo will be checked against the list of
521 - If ``None``: this will raise a warning, inviting the user to set
561 Load a model from a github repo or a local directory.
575 this should correspond to a github repo with format ``repo_owner/repo_name[:ref]`` with
580 repo/dir's ``hubconf.py``.
588 - If ``False``, a prompt will ask the user whether the repo should
590 - If ``True``, the repo will be added to the trusted list and loaded
592 - If ``"check"``, the repo will be checked against the list of
595 - If ``None``: this will raise a warning, inviting the user to set
602 the github repo unconditionally. Does not have any effect if
609 specified by the ``github`` argument properly belongs to the repo owner. This will make
610 requests to the GitHub API; you can specify a non-default GitHub token by setting the
620 >>> # from a github repo
621 >>> repo = "pytorch/vision"
623 ... repo, "resnet50", weights="ResNet50_Weights.IMAGENET1K_V1"
686 ) -> None:
701 ... "https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth",
707 req = Request(url, headers={"User-Agent": "torch.hub"})
711 content_length = meta.getheaders("Content-Length")
713 content_length = meta.get_all("Content-Length")
747 f.write(buffer) # type: ignore[possibly-undefined]
749 sha256.update(buffer) # type: ignore[possibly-undefined]
754 digest = sha256.hexdigest() # type: ignore[possibly-undefined]
769 def _is_legacy_zip_format(filename: str) -> bool:
787 ) -> Dict[str, Any]:
790 # E.g. resnet18-5c106cde.pth which is widely used.
811 ) -> Dict[str, Any]:
829 ``filename-<sha256>.ext`` where ``<sha256>`` is the first eight or more
840 ... "https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth"