English
music
music-captioning
Inference Endpoints
ivillar commited on
Commit
2f127e5
1 Parent(s): d99dc9a

Update requirements and model load

Browse files
Files changed (2) hide show
  1. handler.py +2 -0
  2. requirements.txt +7 -7
handler.py CHANGED
@@ -23,6 +23,8 @@ def preprocess_audio(audio_signal, sr, duration=10, target_sr=16000):
23
 
24
  class EndpointHandler:
25
  def __init__(self, path=""):
 
 
26
  self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
27
  self.model = BartCaptionModel(max_length = 128)
28
  pretrained_object = torch.load('./transfer.pth', map_location='cpu')
 
23
 
24
  class EndpointHandler:
25
  def __init__(self, path=""):
26
+ if os.path.isfile("transfer.pth") == False:
27
+ torch.hub.download_url_to_file('https://huggingface.co/seungheondoh/lp-music-caps/resolve/main/transfer.pth', 'transfer.pth')
28
  self.device = "cuda:0" if torch.cuda.is_available() else "cpu"
29
  self.model = BartCaptionModel(max_length = 128)
30
  pretrained_object = torch.load('./transfer.pth', map_location='cpu')
requirements.txt CHANGED
@@ -1,19 +1,19 @@
1
- datasets==2.18.0
2
- huggingface-hub==0.21.4
3
- julius==0.2.7
4
- librosa==0.10.1
5
  multidict==6.0.5
6
  multiprocess==0.70.16
7
  numpy==1.26.4
8
  packaging==23.2
9
  pandas==2.2.1
10
  pydub==0.25.1
 
11
  scikit-learn==1.4.1.post1
12
  scipy==1.12.0
13
- tokenizers==0.13.3
14
  torch==1.13.1
15
  torchaudio==0.13.1
16
  torchaudio-augmentations==0.2.1
17
- tqdm==4.66.2
18
  transformers==4.26.1
19
- wavaugment==0.2
 
 
 
1
+ tokenizers==0.13.3
2
+ tqdm==4.66.2
 
 
3
  multidict==6.0.5
4
  multiprocess==0.70.16
5
  numpy==1.26.4
6
  packaging==23.2
7
  pandas==2.2.1
8
  pydub==0.25.1
9
+ wavaugment==0.2
10
  scikit-learn==1.4.1.post1
11
  scipy==1.12.0
12
+ librosa==0.10.1
13
  torch==1.13.1
14
  torchaudio==0.13.1
15
  torchaudio-augmentations==0.2.1
 
16
  transformers==4.26.1
17
+ datasets==2.18.0
18
+ huggingface-hub==0.21.4
19
+ julius==0.2.7