Spaces:
Runtime error
Runtime error
try fix running in hf.co
Browse files
app.py
CHANGED
@@ -7,14 +7,13 @@ st.title('Numerai Example Script')
|
|
7 |
# https://github.com/numerai/example-scripts/blob/master/example_model.py
|
8 |
#
|
9 |
|
10 |
-
IS_RUNNING_IN_HUGGING_FACE = False
|
11 |
|
12 |
import pandas as pd
|
13 |
from lightgbm import LGBMRegressor
|
14 |
import gc
|
15 |
import json
|
16 |
from pathlib import Path
|
17 |
-
|
18 |
from numerapi import NumerAPI
|
19 |
from utils import (
|
20 |
save_model,
|
@@ -28,6 +27,7 @@ from utils import (
|
|
28 |
EXAMPLE_PREDS_COL
|
29 |
)
|
30 |
|
|
|
31 |
|
32 |
napi = NumerAPI()
|
33 |
current_round = napi.get_current_round()
|
@@ -38,15 +38,19 @@ current_round = napi.get_current_round()
|
|
38 |
|
39 |
Path("./v4").mkdir(parents=False, exist_ok=True)
|
40 |
|
41 |
-
|
42 |
@st.cache
|
43 |
-
def
|
44 |
-
print('download_dataset')
|
45 |
-
|
46 |
if IS_RUNNING_IN_HUGGING_FACE:
|
47 |
from datasets import load_dataset_builder
|
48 |
ds_builder = load_dataset_builder("Numerati/numerai-datasets")
|
|
|
49 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
napi.download_dataset("v4/train.parquet")
|
51 |
napi.download_dataset("v4/validation.parquet")
|
52 |
napi.download_dataset("v4/validation_example_preds.parquet")
|
|
|
7 |
# https://github.com/numerai/example-scripts/blob/master/example_model.py
|
8 |
#
|
9 |
|
|
|
10 |
|
11 |
import pandas as pd
|
12 |
from lightgbm import LGBMRegressor
|
13 |
import gc
|
14 |
import json
|
15 |
from pathlib import Path
|
16 |
+
import os
|
17 |
from numerapi import NumerAPI
|
18 |
from utils import (
|
19 |
save_model,
|
|
|
27 |
EXAMPLE_PREDS_COL
|
28 |
)
|
29 |
|
30 |
+
IS_RUNNING_IN_HUGGING_FACE = os.environ.get('HF_ENDPOINT') is not None
|
31 |
|
32 |
napi = NumerAPI()
|
33 |
current_round = napi.get_current_round()
|
|
|
38 |
|
39 |
Path("./v4").mkdir(parents=False, exist_ok=True)
|
40 |
|
|
|
41 |
@st.cache
|
42 |
+
def get_dataset_path():
|
|
|
|
|
43 |
if IS_RUNNING_IN_HUGGING_FACE:
|
44 |
from datasets import load_dataset_builder
|
45 |
ds_builder = load_dataset_builder("Numerati/numerai-datasets")
|
46 |
+
return ds_builder.cache_dir
|
47 |
else:
|
48 |
+
return "./v4"
|
49 |
+
|
50 |
+
@st.cache
|
51 |
+
def download_dataset():
|
52 |
+
print('download_dataset')
|
53 |
+
if IS_RUNNING_IN_HUGGING_FACE:
|
54 |
napi.download_dataset("v4/train.parquet")
|
55 |
napi.download_dataset("v4/validation.parquet")
|
56 |
napi.download_dataset("v4/validation_example_preds.parquet")
|