Spaces:
Sleeping
Sleeping
LorenzoBioinfo
commited on
Commit
·
7695575
1
Parent(s):
37bc8d6
Speed test
Browse files- .github/workflows/ci.yml +9 -0
- src/monitoring.py +4 -1
.github/workflows/ci.yml
CHANGED
|
@@ -24,6 +24,15 @@ jobs:
|
|
| 24 |
python -m pip install --upgrade pip
|
| 25 |
pip install -r requirements.txt
|
| 26 |
pip install flake8 pytest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
- name: Prepare processed data
|
| 28 |
run: |
|
| 29 |
mkdir -p data/processed
|
|
|
|
| 24 |
python -m pip install --upgrade pip
|
| 25 |
pip install -r requirements.txt
|
| 26 |
pip install flake8 pytest
|
| 27 |
+
|
| 28 |
+
- name: Cache Hugging Face and datasets
|
| 29 |
+
uses: actions/cache@v4
|
| 30 |
+
with:
|
| 31 |
+
path: |
|
| 32 |
+
~/.cache/huggingface
|
| 33 |
+
~/.cache/datasets
|
| 34 |
+
key: ${{ runner.os }}-hf-${{ hashFiles('requirements.txt') }}
|
| 35 |
+
|
| 36 |
- name: Prepare processed data
|
| 37 |
run: |
|
| 38 |
mkdir -p data/processed
|
src/monitoring.py
CHANGED
|
@@ -15,7 +15,10 @@ REPORTS_DIR = "reports"
|
|
| 15 |
|
| 16 |
def evaluate_model(model, tokenizer, dataset, dataset_name, sample_size=300):
|
| 17 |
print(f"Valutazione su {dataset_name}")
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
texts = subset["text"]
|
| 21 |
labels = subset["label"]
|
|
|
|
| 15 |
|
| 16 |
def evaluate_model(model, tokenizer, dataset, dataset_name, sample_size=300):
|
| 17 |
print(f"Valutazione su {dataset_name}")
|
| 18 |
+
if "test" not in dataset:
|
| 19 |
+
subset = dataset["train"].train_test_split(test_size=0.1)
|
| 20 |
+
else:
|
| 21 |
+
subset = dataset["test"].select(range(min(sample_size, len(dataset["test"]))))
|
| 22 |
|
| 23 |
texts = subset["text"]
|
| 24 |
labels = subset["label"]
|