Abhishek Thakur
commited on
Commit
·
8e26e22
1
Parent(s):
6e287cd
remove try-except
Browse files- competitions/info.py +18 -27
competitions/info.py
CHANGED
|
@@ -3,8 +3,6 @@ from dataclasses import dataclass
|
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
-
from huggingface_hub.utils._errors import EntryNotFoundError
|
| 7 |
-
from loguru import logger
|
| 8 |
|
| 9 |
|
| 10 |
@dataclass
|
|
@@ -13,31 +11,24 @@ class CompetitionInfo:
|
|
| 13 |
autotrain_token: str
|
| 14 |
|
| 15 |
def __post_init__(self):
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
)
|
| 35 |
-
except EntryNotFoundError:
|
| 36 |
-
raise Exception("Competition config not found. Please check the competition id.")
|
| 37 |
-
except Exception as e:
|
| 38 |
-
logger.error(e)
|
| 39 |
-
raise Exception("Hugging Face Hub is unreachable, please try again later.")
|
| 40 |
-
|
| 41 |
self.config = self.load_config(config_fname)
|
| 42 |
self.competition_desc = self.load_md(competition_desc)
|
| 43 |
self.dataset_desc = self.load_md(dataset_desc)
|
|
|
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
@dataclass
|
|
|
|
| 11 |
autotrain_token: str
|
| 12 |
|
| 13 |
def __post_init__(self):
|
| 14 |
+
config_fname = hf_hub_download(
|
| 15 |
+
repo_id=self.competition_id,
|
| 16 |
+
filename="conf.json",
|
| 17 |
+
use_auth_token=self.autotrain_token,
|
| 18 |
+
repo_type="dataset",
|
| 19 |
+
)
|
| 20 |
+
competition_desc = hf_hub_download(
|
| 21 |
+
repo_id=self.competition_id,
|
| 22 |
+
filename="COMPETITION_DESC.md",
|
| 23 |
+
use_auth_token=self.autotrain_token,
|
| 24 |
+
repo_type="dataset",
|
| 25 |
+
)
|
| 26 |
+
dataset_desc = hf_hub_download(
|
| 27 |
+
repo_id=self.competition_id,
|
| 28 |
+
filename="DATASET_DESC.md",
|
| 29 |
+
use_auth_token=self.autotrain_token,
|
| 30 |
+
repo_type="dataset",
|
| 31 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
self.config = self.load_config(config_fname)
|
| 33 |
self.competition_desc = self.load_md(competition_desc)
|
| 34 |
self.dataset_desc = self.load_md(dataset_desc)
|