Commit
·
3afdb4b
1
Parent(s):
2c02472
add read_from_url logging
Browse files
P3.py
CHANGED
|
@@ -41,6 +41,9 @@ _DATA_PATH = "data"
|
|
| 41 |
_HUB_PATH = "https://huggingface.co/datasets/bigscience/P3/raw/main"
|
| 42 |
|
| 43 |
|
|
|
|
|
|
|
|
|
|
| 44 |
def load_cached_task(features_dict, tfrecord):
|
| 45 |
# Use `FixedLenSequenceFeature` for sequences with variable length.
|
| 46 |
def _feature_config(shape, dtype):
|
|
@@ -76,6 +79,7 @@ def read_from_url(url):
|
|
| 76 |
# TODO: Ultimately, we should rely on the cache if internet is not available.
|
| 77 |
try:
|
| 78 |
content = urllib.request.urlopen(url, timeout=10.0)
|
|
|
|
| 79 |
except urllib.error.URLError as e:
|
| 80 |
raise ConnectionError(e)
|
| 81 |
return content.read().decode("utf-8")
|
|
|
|
| 41 |
_HUB_PATH = "https://huggingface.co/datasets/bigscience/P3/raw/main"
|
| 42 |
|
| 43 |
|
| 44 |
+
logger = datasets.logging.get_logger(__name__)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
def load_cached_task(features_dict, tfrecord):
|
| 48 |
# Use `FixedLenSequenceFeature` for sequences with variable length.
|
| 49 |
def _feature_config(shape, dtype):
|
|
|
|
| 79 |
# TODO: Ultimately, we should rely on the cache if internet is not available.
|
| 80 |
try:
|
| 81 |
content = urllib.request.urlopen(url, timeout=10.0)
|
| 82 |
+
logger.info(f"Downloaded {url}")
|
| 83 |
except urllib.error.URLError as e:
|
| 84 |
raise ConnectionError(e)
|
| 85 |
return content.read().decode("utf-8")
|