[-] Remove unused torchvision and numba

This commit is contained in:
2024-09-05 19:34:12 -04:00
parent 59bc8446e3
commit 8dbe06ee63
4 changed files with 1174 additions and 1007 deletions
+4 -1
View File
@@ -350,4 +350,7 @@ MigrationBackup/
.ionide/ .ionide/
dist/ dist/
.DS_Store .DS_Store
._* ._*
venv/
root_path/
+23 -3
View File
@@ -1,6 +1,6 @@
from torch.utils.data import Dataset from torch.utils.data import Dataset
from torchvision.datasets.utils import download_url
from tqdm import tqdm from tqdm import tqdm
from pathlib import Path
import pandas as pd import pandas as pd
import os import os
import torch.nn as nn import torch.nn as nn
@@ -74,9 +74,29 @@ class ESC50(AudioDataset):
return len(self.audio_paths) return len(self.audio_paths)
def download(self): def download(self):
download_url(self.url, self.root, self.filename) # Download file using requests
import requests
file = Path(self.root) / self.filename
if file.is_file():
return
r = requests.get(self.url, stream=True)
# extract file # To prevent partial downloads, download to a temp file first
tmp = file.with_suffix('.tmp')
tmp.parent.mkdir(parents=True, exist_ok=True)
with open(tmp, 'wb') as f:
pbar = tqdm(unit=" MB", bar_format=f'{file.name}: {{rate_noinv_fmt}}')
for chunk in r.iter_content(chunk_size=1024):
if chunk:
pbar.update(len(chunk) / 1024 / 1024)
f.write(chunk)
# move temp file to correct location
tmp.rename(file)
# # extract file
from zipfile import ZipFile from zipfile import ZipFile
with ZipFile(os.path.join(self.root, self.filename), 'r') as zip: with ZipFile(os.path.join(self.root, self.filename), 'r') as zip:
zip.extractall(path=self.root) zip.extractall(path=self.root)
Generated
+1146 -1001
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -13,16 +13,15 @@ packages = [
python = "^3.8" python = "^3.8"
librosa = "^0.10.1" librosa = "^0.10.1"
numpy = "^1.23.0" numpy = "^1.23.0"
numba = "^0.58.0"
pandas = "^2.0.0" pandas = "^2.0.0"
torch = "^2.1.0" torch = "^2.1.0"
torchaudio = "^2.1.0" torchaudio = "^2.1.0"
torchlibrosa = "^0.1.0" torchlibrosa = "^0.1.0"
torchvision = "^0.16.0"
tqdm = "^4.66.1" tqdm = "^4.66.1"
transformers = "^4.34.0" transformers = "^4.34.0"
pyyaml = "^6.0.1" pyyaml = "^6.0.1"
scikit-learn = "^1.3.1" scikit-learn = "^1.3.1"
requests = "*"
[build-system] [build-system]