Spaces:
Runtime error
Runtime error
waidhoferj
commited on
Commit
•
e748bc2
1
Parent(s):
c8de10b
reduced requirements
Browse files- environment.yml +0 -10
- models/utils.py +1 -5
- requirements.txt +0 -1
environment.yml
CHANGED
@@ -8,15 +8,11 @@ dependencies:
|
|
8 |
- python=3.10
|
9 |
- pytorch
|
10 |
- torchaudio
|
11 |
-
- torchvision
|
12 |
- librosa
|
13 |
- numpy
|
14 |
- pandas
|
15 |
-
- seaborn
|
16 |
-
- matplotlib
|
17 |
- bs4
|
18 |
- requests
|
19 |
-
- bidict
|
20 |
- tqdm
|
21 |
- pytorch-lightning
|
22 |
- rich
|
@@ -25,9 +21,3 @@ dependencies:
|
|
25 |
- transformers
|
26 |
- accelerate
|
27 |
- pytest
|
28 |
-
|
29 |
-
- pip:
|
30 |
-
- evaluate
|
31 |
-
- wakepy
|
32 |
-
- soundfile
|
33 |
-
- youtube_dl
|
|
|
8 |
- python=3.10
|
9 |
- pytorch
|
10 |
- torchaudio
|
|
|
11 |
- librosa
|
12 |
- numpy
|
13 |
- pandas
|
|
|
|
|
14 |
- bs4
|
15 |
- requests
|
|
|
16 |
- tqdm
|
17 |
- pytorch-lightning
|
18 |
- rich
|
|
|
21 |
- transformers
|
22 |
- accelerate
|
23 |
- pytest
|
|
|
|
|
|
|
|
|
|
|
|
models/utils.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1 |
import torch.nn as nn
|
2 |
import torch
|
3 |
import numpy as np
|
4 |
-
import evaluate
|
5 |
from sklearn.metrics import precision_score, recall_score, f1_score, accuracy_score
|
6 |
|
7 |
|
8 |
-
accuracy = evaluate.load("accuracy")
|
9 |
-
|
10 |
-
|
11 |
class LabelWeightedBCELoss(nn.Module):
|
12 |
"""
|
13 |
Binary Cross Entropy loss that assumes each float in the final dimension is a binary probability distribution.
|
@@ -86,4 +82,4 @@ def get_id_label_mapping(labels: list[str]) -> tuple[dict, dict]:
|
|
86 |
|
87 |
def compute_hf_metrics(eval_pred):
|
88 |
predictions = np.argmax(eval_pred.predictions, axis=1)
|
89 |
-
return
|
|
|
1 |
import torch.nn as nn
|
2 |
import torch
|
3 |
import numpy as np
|
|
|
4 |
from sklearn.metrics import precision_score, recall_score, f1_score, accuracy_score
|
5 |
|
6 |
|
|
|
|
|
|
|
7 |
class LabelWeightedBCELoss(nn.Module):
|
8 |
"""
|
9 |
Binary Cross Entropy loss that assumes each float in the final dimension is a binary probability distribution.
|
|
|
82 |
|
83 |
def compute_hf_metrics(eval_pred):
|
84 |
predictions = np.argmax(eval_pred.predictions, axis=1)
|
85 |
+
return accuracy_score(y_true=eval_pred.label_ids, y_pred=predictions)
|
requirements.txt
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
torch
|
2 |
-
torchvision
|
3 |
torchaudio
|
4 |
pytorch-lightning
|
5 |
numpy
|
|
|
1 |
torch
|
|
|
2 |
torchaudio
|
3 |
pytorch-lightning
|
4 |
numpy
|