forked from activeloopai/deeplake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
67 lines (51 loc) · 1.78 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
License:
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""
import numpy as np
from .collections import dataset
from .collections.dataset.core import Transform
from .collections import tensor
from .collections.dataset import load as load_v0
from .collections.client_manager import init
import hub.config
from hub.api.dataset import Dataset
from hub.compute import transform
from hub.log import logger
import traceback
from hub.exceptions import DaskModuleNotInstalledException, HubDatasetNotFoundException
from hub.report import hub_reporter, hub_tags
from hub.version import __version__
hub_reporter.setup_excepthook(tags=hub_tags)
hub_reporter.system_report(tags=hub_tags)
def local_mode():
hub.config.HUB_REST_ENDPOINT = hub.config.HUB_LOCAL_REST_ENDPOINT
def dev_mode():
hub.config.HUB_REST_ENDPOINT = hub.config.HUB_DEV_REST_ENDPOINT
def dtype(*args, **kwargs):
return np.dtype(*args, **kwargs)
def load(tag):
"""
Load a dataset from repository using given tag
Args:
tag: string
using {username}/{dataset} format or file system, s3://, gcs://
Notes
------
It will try to load using old version and fall off on newer version
"""
try:
ds = load_v0(tag)
logger.warning(
"Deprecated Warning: Given dataset is using deprecated format v0.x. Please convert to v1.x version upon availability."
)
return ds
except ImportError:
raise DaskModuleNotInstalledException
except HubDatasetNotFoundException:
raise
except Exception as e:
pass
# logger.warning(traceback.format_exc() + str(e))
return Dataset(tag)