/usr/local/lib64/python3.6/site-packages/torch/__pycache__
NameSizeModeActions
autocast_mode.cpython-36.pyc90400644editdlrm
functional.cpython-36.pyc599640644editdlrm
hub.cpython-36.pyc191710644editdlrm
overrides.cpython-36.pyc1243060644editdlrm
quasirandom.cpython-36.pyc67390644editdlrm
random.cpython-36.pyc42710644editdlrm
serialization.cpython-36.pyc285820644editdlrm
storage.cpython-36.pyc83340644editdlrm
torch_version.cpython-36.pyc29650644editdlrm
types.cpython-36.pyc17350644editdlrm
version.cpython-36.pyc2720644editdlrm
_appdirs.cpython-36.pyc220230644editdlrm
_classes.cpython-36.pyc24730644editdlrm
_deploy.cpython-36.pyc22620644editdlrm
_jit_internal.cpython-36.pyc337230644editdlrm
_linalg_utils.cpython-36.pyc28830644editdlrm
_lobpcg.cpython-36.pyc302630644editdlrm
_lowrank.cpython-36.pyc94730644editdlrm
_namedtensor_internals.cpython-36.pyc48560644editdlrm
_ops.cpython-36.pyc41770644editdlrm
_python_dispatcher.cpython-36.pyc34110644editdlrm
_six.cpython-36.pyc10930644editdlrm
_sources.cpython-36.pyc40430644editdlrm
_storage_docs.cpython-36.pyc14360644editdlrm
_tensor.cpython-36.pyc372740644editdlrm
_tensor_docs.cpython-36.pyc1027930644editdlrm
_tensor_str.cpython-36.pyc115320644editdlrm
_torch_docs.cpython-36.pyc3646960644editdlrm
_utils.cpython-36.pyc168940644editdlrm
_utils_internal.cpython-36.pyc13220644editdlrm
_VF.cpython-36.pyc11120644editdlrm
_vmap_internals.cpython-36.pyc112100644editdlrm
__config__.cpython-36.pyc7330644editdlrm
__future__.cpython-36.pyc9840644editdlrm
__init__.cpython-36.pyc244180644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/__pycache__/hub.cpython-36.pyc (19171B)
3 EgK[@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZddlmZyddlmZWnJek ryddlmZWn$ek rGdddeZYnXYnXejdZd Zd Zd Zd Zd ZdZdZdaddZ ddZ!ddZ"ddZ#ddZ$ddZ%ddZ&ddZ'dBd"d#Z(d$d%Z)d&d'Z*d(d)Z+d*d+Z,d,d-Z-dCd.d/Z.dDd0d1Z/d2d!d d!d3d4d5Z0d6d7Z1dEd8d9Z2dFd:d;Z3dd?Z5dGd@dAZ6dS)HN) HTTPError)urlopenRequest)urlparse)tqdmc@s6eZdZd ddZddZddZd d Zd d ZdS)rNFcCs||_||_d|_dS)Nr)totaldisablen)selfrrunit unit_scale unit_divisorr5/usr/local/lib64/python3.6/site-packages/torch/hub.py__init__sz tqdm.__init__cCsh|jr dS|j|7_|jdkr8tjjdj|jn"tjjdjd|jt|jtjjdS)Nz {0:.1f} bytesz {0:.1f}%d) rr rsysstderrwriteformatfloatflush)r r rrrupdate!s "z tqdm.updatecCs d|_dS)NT)r)r rrrclose,sz tqdm.closecCs|S)Nr)r rrr __enter__/sztqdm.__enter__cCs|jr dStjjddS)N )rrrr)r exc_typeexc_valexc_tbrrr__exit__2sz tqdm.__exit__)NFNNN)__name__ __module__ __qualname__rrrrrrrrrrs   rz-([a-f0-9]*)\.Z GITHUB_TOKENZ TORCH_HOMEXDG_CACHE_HOMEz~/.cache dependenciesz hubconf.pyi cCsNddl}ddlm}|jj||}|jj|}t|j|s>t|jj ||S)Nr)Loader) importlib.utilZ importlib.abcr%utilspec_from_file_locationmodule_from_spec isinstanceloaderAssertionError exec_module)namepath importlibr%specmodulerrr import_moduleFs   r3cCs2tjj|r.tjj|r$tj|n tj|dS)N)osr/existsisfileremoveshutilrmtree)r/rrr_remove_if_existsPs   r:cCsdj|||S)Nz'https://github.com/{}/{}/archive/{}.zip)r) repo_owner repo_namebranchrrr_git_archive_linkXsr>cCs|t|krdSt||S)N)dirgetattr)r2 func_namerrr_load_attr_from_module\s rBcCs*tjjtjttjjtjttd}|S)Ntorch)r4r/ expandusergetenvENV_TORCH_HOMEjoinENV_XDG_CACHE_HOMEDEFAULT_CACHE_DIR)Z torch_homerrr_get_torch_homecs  rJcCsd|kr|jd\}}n |d}}|jd\}}|dkry*td|d|d d}WdQRXWn4tk r}z|jdkrd}nWYdd}~XnX|||fS)N:/zhttps://github.com/z /tree/main/mainiZmaster)splitrrcode)githubZ repo_infor=r;r<errr_parse_repo_infoks  rRc Cs*t|}|jj|jjdSQRXdS)Nzutf-8)rreaddecodeheadersget_content_charset)urlrrrr _read_urls rYc Csddi}tjjt}|dk r*d||d<xd|d|dd|d|dfD]p}d }xf|d 7}|d |}tjtt||d }|sPx.|D]&} | d |ks| ddj|rdSqWqZWqPWt d|d|d|ddS)NAcceptzapplication/vnd.github.v3+jsonztoken Authorizationzhttps://api.github.com/repos/rLz /branchesz/tagsrz?per_page=100&page=)rUr.commitshaz Cannot find z in https://github.com/zX. If it's a commit from a forked repo, please call hub.load() with forked repo directly.) r4environgetENV_GITHUB_TOKENjsonloadsrYr startswith ValueError) r;r<r=rUtokenZ url_prefixpagerWresponsebrrrr_validate_not_a_forked_repos$  rjTFc Cs:t}tjj|stj|t|\}}}|jdd}tjj|dj|||g} | o`tjj| } | r~|r|tj j dj | n|st |||tjj||d} t | t|||} tj j dj | | t| | ddtj| 4} | jdj}tjj||}t || j|WdQRXt | t | tj|| | S) NrL_zUsing cache found in {} z.zipzDownloading: "{}" to {} F)progressr)get_dirr4r/r5makedirsrRreplacerGrrrrrjr:r>download_url_to_filezipfileZipFileinfolistfilename extractallr8move)rP force_reloadverboseskip_validationhub_dirr;r<r=Z normalized_brrepo_dirZ use_cache cached_filerWZcached_zipfileZextraced_repo_nameZextracted_reporrr_get_cache_or_reloads4       r}cCsddl}|jj|dk S)Nr)r&r' find_spec)r.r0rrr_check_module_existssrcCs@t|t}|dk rsz'_check_dependencies..zMissing dependencies: {}z, )rBVAR_DEPENDENCYlen RuntimeErrorrrG)mr$ missing_depsrrr_check_dependenciess  rcCsHt|tstdt|t||}|dks6t| rDtdj||S)Nz8Invalid input: model should be a string of function namez"Cannot find callable {} in hubconf)r*strrerrBcallablerr)rmodelfuncrrr_load_entry_from_hubconfs  rcCs0tjdrtjdtdk r tStjjtdS)a Get the Torch Hub cache directory used for storing downloaded models & weights. If :func:`~torch.hub.set_dir` is not called, default path is ``$TORCH_HOME/hub`` where environment variable ``$TORCH_HOME`` defaults to ``$XDG_CACHE_HOME/torch``. ``$XDG_CACHE_HOME`` follows the X Design Group specification of the Linux filesystem layout, with a default value ``~/.cache`` if the environment variable is not set. Z TORCH_HUBz:TORCH_HUB is deprecated, please use env TORCH_HOME insteadNZhub)r4rEwarningswarn_hub_dirr/rGrJrrrrrms  rmcCs|adS)z Optionally set the Torch Hub directory used to save downloaded models & weights. Args: d (string): path to a local folder to save downloaded models & weights. N)r)drrrset_dirsrcs\t||d|d}tjjd|tjj|t}tt|tjj|fddt D}|S)a" List all callable entrypoints available in the repo specified by ``github``. Args: github (string): a string with format "repo_owner/repo_name[:tag_name]" with an optional tag/branch. If ``tag_name`` is not specified, the default branch is assumed to be ``main`` if it exists, and otherwise ``master``. Example: 'pytorch/vision:0.10' force_reload (bool, optional): whether to discard the existing cache and force a fresh download. Default is ``False``. skip_validation (bool, optional): if ``False``, torchhub will check that the branch or commit specified by the ``github`` argument properly belongs to the repo owner. This will make requests to the GitHub API; you can specify a non-default GitHub token by setting the ``GITHUB_TOKEN`` environment variable. Default is ``False``. Returns: list: The available callables entrypoint Example: >>> entrypoints = torch.hub.list('pytorch/vision', force_reload=True) T)rxryrcs*g|]"}tt|r|jd r|qS)rk)rr@rd)rf) hub_modulerrr-szlist..) r}rr/insertr4rGMODULE_HUBCONFr3r7r?)rPrwryr{ hubconf_pathZ entrypointsr)rrlists  rcCsRt||d|d}tjjd|tjj|t}tt|}tjj|t ||}|j S)a Show the docstring of entrypoint ``model``. Args: github (string): a string with format with an optional tag/branch. If ``tag_name`` is not specified, the default branch is assumed to be ``main`` if it exists, and otherwise ``master``. Example: 'pytorch/vision:0.10' model (string): a string of entrypoint name defined in repo's ``hubconf.py`` force_reload (bool, optional): whether to discard the existing cache and force a fresh download. Default is ``False``. skip_validation (bool, optional): if ``False``, torchhub will check that the branch or commit specified by the ``github`` argument properly belongs to the repo owner. This will make requests to the GitHub API; you can specify a non-default GitHub token by setting the ``GITHUB_TOKEN`` environment variable. Default is ``False``. Example: >>> print(torch.hub.help('pytorch/vision', 'resnet18', force_reload=True)) T)rxryr) r}rr/rr4rGrr3r7r__doc__)rPrrwryr{rrentryrrrhelp2s   rrP)sourcerwrxrycOsL|j}|dkr td|d|dkr6t||||}t||f||}|S)a( Load a model from a github repo or a local directory. Note: Loading a model is the typical use case, but this can also be used to for loading other objects such as tokenizers, loss functions, etc. If ``source`` is 'github', ``repo_or_dir`` is expected to be of the form ``repo_owner/repo_name[:tag_name]`` with an optional tag/branch. If ``source`` is 'local', ``repo_or_dir`` is expected to be a path to a local directory. Args: repo_or_dir (string): If ``source`` is 'github', this should correspond to a github repo with format ``repo_owner/repo_name[:tag_name]`` with an optional tag/branch, for example 'pytorch/vision:0.10'. If ``tag_name`` is not specified, the default branch is assumed to be ``main`` if it exists, and otherwise ``master``. If ``source`` is 'local' then it should be a path to a local directory. model (string): the name of a callable (entrypoint) defined in the repo/dir's ``hubconf.py``. *args (optional): the corresponding args for callable ``model``. source (string, optional): 'github' or 'local'. Specifies how ``repo_or_dir`` is to be interpreted. Default is 'github'. force_reload (bool, optional): whether to force a fresh download of the github repo unconditionally. Does not have any effect if ``source = 'local'``. Default is ``False``. verbose (bool, optional): If ``False``, mute messages about hitting local caches. Note that the message about first download cannot be muted. Does not have any effect if ``source = 'local'``. Default is ``True``. skip_validation (bool, optional): if ``False``, torchhub will check that the branch or commit specified by the ``github`` argument properly belongs to the repo owner. This will make requests to the GitHub API; you can specify a non-default GitHub token by setting the ``GITHUB_TOKEN`` environment variable. Default is ``False``. **kwargs (optional): the corresponding kwargs for callable ``model``. Returns: The output of the ``model`` callable when called with the given ``*args`` and ``**kwargs``. Example: >>> # from a github repo >>> repo = 'pytorch/vision' >>> model = torch.hub.load(repo, 'resnet50', pretrained=True) >>> # from a local directory >>> path = '/some/local/path/pytorch/vision' >>> model = torch.hub.load(path, 'resnet50', pretrained=True) rPlocalzUnknown source: "z&". Allowed values: "github" | "local".)rPr)lowerrer} _load_local)Z repo_or_dirrrrwrxryargskwargsrrrloadSs3rcOsJtjjd|tjj|t}tt|}t||}|||}tjj||S)a Load a model from a local directory with a ``hubconf.py``. Args: hubconf_dir (string): path to a local directory that contains a ``hubconf.py``. model (string): name of an entrypoint defined in the directory's ``hubconf.py``. *args (optional): the corresponding args for callable ``model``. **kwargs (optional): the corresponding kwargs for callable ``model``. Returns: a single model with corresponding pretrained weights. Example: >>> path = '/some/local/path/pytorch/vision' >>> model = _load_local(path, 'resnet50', pretrained=True) r) rr/rr4rGrr3rr7)Z hubconf_dirrrrrrrrrrrs    rcCsd}t|ddid}t|}|j}t|dr:|jd}n |jd}|dk rdt|dkrdt|d}tj j |}tj j |} t j d| d } z|dk rtj} t|| d d d d N} xF|jd} t| dkrP| j| |dk r| j| | jt| qWWdQRX| j|dk rD| j}|dt||krDtdj||tj| j|Wd| jtj j| jrztj| jXdS)a]Download object at the given URL to a local path. Args: url (string): URL of the object to download dst (string): Full path where object will be saved, e.g. ``/tmp/temporary_file`` hash_prefix (string, optional): If not None, the SHA256 downloaded file should start with ``hash_prefix``. Default: None progress (bool, optional): whether or not to display a progress bar to stderr Default: True Example: >>> torch.hub.download_url_to_file('https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth', '/tmp/temporary_file') Nz User-Agentz torch.hub)rU getheaderszContent-LengthrF)deleter?BTi)rrr r r i z,invalid hash value (expected "{}", got "{}"))rrinfohasattrrget_allrintr4r/rDdirnametempfileNamedTemporaryFilehashlibsha256rrSrrr hexdigestrrr8rvr.r5r7)rWdst hash_prefixrl file_sizerequmetacontent_lengthZdst_dirrrZpbarbufferdigestrrrrpsF            rpcCstjdt||||dS)Nztorch.hub._download_url_to_file has been renamed to torch.hub.download_url_to_file to be a public API, _download_url_to_file will be removed in after 1.3 release)rrrp)rWrrrlrrr_download_url_to_filesrcCs6tj|r2tj|j}t|dko0|dj SdS)Nr\rF)rq is_zipfilerrrsris_dir)rtrsrrr_is_legacy_zip_formats rc Csltjdtj|D}|j}t|dkr2td|j||dj}t j j ||}WdQRXt j ||dS)NzFalling back to the old format < 1.6. This support will be deprecated in favor of default zipfile format introduced in 1.6. Please redo torch.save() to save it in the new zipfile format.r\z0Only one file(not dir) is allowed in the zipfiler) map_location)rrrqrrrsrrrurtr4r/rGrCr)rt model_dirrrmembersZ extraced_nameZextracted_filerrr_legacy_zip_loads     rc Cstjdrtjd|dkr0t}tjj|d}ytj|Wn2tk rp}z|j t j kr^nWYdd}~XnXt |}tjj |j} |dk r|} tjj|| } tjj | stjjdj|| d} |rtj| } | r| jdnd} t|| | |dt| r t| ||Stj| |dS) a_Loads the Torch serialized object at the given URL. If downloaded file is a zip file, it will be automatically decompressed. If the object is already present in `model_dir`, it's deserialized and returned. The default value of ``model_dir`` is ``/checkpoints`` where ``hub_dir`` is the directory returned by :func:`~torch.hub.get_dir`. Args: url (string): URL of the object to download model_dir (string, optional): directory in which to save the object map_location (optional): a function or a dict specifying how to remap storage locations (see torch.load) progress (bool, optional): whether or not to display a progress bar to stderr. Default: True check_hash(bool, optional): If True, the filename part of the URL should follow the naming convention ``filename-.ext`` where ```` is the first eight or more digits of the SHA256 hash of the contents of the file. The hash is used to ensure unique names and to verify the contents of the file. Default: False file_name (string, optional): name for the downloaded file. Filename from ``url`` will be used if not set. Example: >>> state_dict = torch.hub.load_state_dict_from_url('https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth') ZTORCH_MODEL_ZOOz@TORCH_MODEL_ZOO is deprecated, please use env TORCH_HOME insteadNZ checkpointszDownloading: "{}" to {} r\)rl)r)r4rErrrmr/rGrnOSErrorerrnoEEXISTrbasenamer5rrrr HASH_REGEXsearchgrouprprrrCr) rWrrrlZ check_hash file_namerzrQpartsrtr|rrXrrrload_state_dict_from_urls4       r)TF)FF)FF)NT)NT)NNTFN)7rrrbr4rer8rrrCrrq urllib.errorrurllib.requestrr urllib.parserZ tqdm.autor ImportErrorobjectcompilerrarFrHrIrrZREAD_DATA_CHUNKrr3r:r>rBrJrRrYrjr}rrrrmrrrrrrprrrrrrrrsh  !   1  $ !@ <