dlxj commited on
Commit
728b833
1 Parent(s): df218d3

torchaudio.save("t.wav", tensor.unsqueeze(0), sampling_rate, bits_per_sample=16)

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. train.py +8 -1
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ t.wav
train.py CHANGED
@@ -1,4 +1,4 @@
1
- # pip install numpy==1.26.4 transformers==4.45.2 datasets==3.0.1 librosa==0.10.2.post1 jiwer==3.0.4 bitsandbytes==0.38.0.post1 accelerate==0.26.0
2
 
3
  dataset_name = "dlxjj/common_voice_17_0"
4
  language = "Japanese"
@@ -14,4 +14,11 @@ print(common_voice["train"][0])
14
 
15
  array = common_voice["train"][0]["audio"]["array"]
16
 
 
 
 
 
 
 
 
17
  pass
 
1
+ # pip install numpy==1.26.4 torchaudio==0.13.1 transformers==4.45.2 datasets==3.0.1 librosa==0.10.2.post1 jiwer==3.0.4 bitsandbytes==0.38.0.post1 accelerate==0.26.0
2
 
3
  dataset_name = "dlxjj/common_voice_17_0"
4
  language = "Japanese"
 
14
 
15
  array = common_voice["train"][0]["audio"]["array"]
16
 
17
+ import torch, numpy as np, torchaudio
18
+
19
+ tensor = torch.tensor(np.array( array, dtype='float32'))
20
+
21
+ sampling_rate = 48000
22
+ torchaudio.save("t.wav", tensor.unsqueeze(0), sampling_rate, bits_per_sample=16)
23
+
24
  pass