|
|
@ -1,20 +1,24 @@
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from functools import partial
|
|
|
|
from functools import partial
|
|
|
|
from typing import Union, Optional
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from typing import Optional, Union
|
|
|
|
|
|
|
|
|
|
|
|
import torch
|
|
|
|
import torch
|
|
|
|
from torch.hub import load_state_dict_from_url, download_url_to_file, urlparse, HASH_REGEX
|
|
|
|
from torch.hub import (HASH_REGEX, download_url_to_file,
|
|
|
|
|
|
|
|
load_state_dict_from_url, urlparse)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from torch.hub import get_dir
|
|
|
|
from torch.hub import get_dir
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
from torch.hub import _get_torch_home as get_dir
|
|
|
|
from torch.hub import _get_torch_home as get_dir
|
|
|
|
|
|
|
|
|
|
|
|
from timm import __version__
|
|
|
|
from timm import __version__
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from huggingface_hub import cached_download, hf_hub_url, HfFolder, HfApi, Repository
|
|
|
|
from huggingface_hub import (HfApi, HfFolder, Repository, cached_download,
|
|
|
|
|
|
|
|
hf_hub_url)
|
|
|
|
cached_download = partial(cached_download, library_name="timm", library_version=__version__)
|
|
|
|
cached_download = partial(cached_download, library_name="timm", library_version=__version__)
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
hf_hub_url = None
|
|
|
|
hf_hub_url = None
|
|
|
|