tlemagueresse
commited on
Commit
·
cf27fba
1
Parent(s):
ab4c4a0
Delete the second example
Browse files
README.md
CHANGED
@@ -106,7 +106,7 @@ Two example scripts demonstrating how to use the repository or the model downloa
|
|
106 |
|
107 |
### Performance
|
108 |
|
109 |
-
- **Accuracy**: Achieved 95% on the test set with a 4.5% FPR at the default threshold during the challenge
|
110 |
- **Environmental Impact**: Inference energy consumption was measured at **0.21 Wh**, tracked using CodeCarbon. This metric is dependent on the challenge's infrastructure, as the code was executed within a Docker container provided by the platform.
|
111 |
|
112 |
---
|
|
|
106 |
|
107 |
### Performance
|
108 |
|
109 |
+
- **Accuracy**: Achieved 95% on the test set with a 4.5% FPR at the default threshold during the challenge.
|
110 |
- **Environmental Impact**: Inference energy consumption was measured at **0.21 Wh**, tracked using CodeCarbon. This metric is dependent on the challenge's infrastructure, as the code was executed within a Docker container provided by the platform.
|
111 |
|
112 |
---
|
examples/{example_usage_fastmodel.py → example_usage.py}
RENAMED
File without changes
|
examples/example_usage_fastmodel_hf.py
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
from datasets import load_dataset
|
2 |
-
from huggingface_hub import hf_hub_download
|
3 |
-
from sklearn.metrics import accuracy_score
|
4 |
-
import importlib.util
|
5 |
-
|
6 |
-
repo_id = "tlmk22/QuefrencyGuardian"
|
7 |
-
model_file = "model.py"
|
8 |
-
model_path = hf_hub_download(repo_id=repo_id, filename=model_file)
|
9 |
-
spec = importlib.util.spec_from_file_location("model", model_path)
|
10 |
-
model_module = importlib.util.module_from_spec(spec)
|
11 |
-
spec.loader.exec_module(model_module)
|
12 |
-
FastModelHuggingFace = model_module.FastModelHuggingFace
|
13 |
-
fast_model = FastModelHuggingFace.from_pretrained(repo_id)
|
14 |
-
|
15 |
-
# Perform predictions for a single WAV file
|
16 |
-
map_labels = {0: "chainsaw", 1: "environment"}
|
17 |
-
wav_prediction = fast_model.predict("chainsaw.wav", device="cpu")
|
18 |
-
print(f"Prediction : {map_labels[wav_prediction[0]]}")
|
19 |
-
|
20 |
-
# Example: predicting on a Hugging Face dataset
|
21 |
-
dataset = load_dataset("rfcx/frugalai")
|
22 |
-
test_dataset = dataset["test"]
|
23 |
-
true_label = dataset["test"]["label"]
|
24 |
-
|
25 |
-
predictions = fast_model.predict(dataset["test"])
|
26 |
-
print(accuracy_score(true_label, predictions))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|