I'm burnt out, I can't get multithreaded audio feature extractor to work :(
This commit is contained in:
32
mtafe_lab/mtafe.py
Normal file
32
mtafe_lab/mtafe.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import logging
|
||||
logging.basicConfig(format="%(asctime)s/%(levelname)s: [%(module)s] %(message)s", level=logging.INFO)
|
||||
|
||||
import multiprocessing
|
||||
import multiprocessing.process
|
||||
import dataset
|
||||
import audiopreprocessing
|
||||
from pathlib import Path
|
||||
|
||||
def copy_worker(origin_queue, target_queue):
|
||||
p = origin_queue.get()
|
||||
logging.info(f"Processing: {p}")
|
||||
l = audiopreprocessing.load_preprocessed_audio(p, 32000, True)
|
||||
print("Preprocess complete, putting it into queue")
|
||||
target_queue.put(l) # Even on a small scale test, the process will always hang here
|
||||
|
||||
if __name__ == "__main__":
|
||||
audio_path_queue = multiprocessing.Queue()
|
||||
audio_queue = multiprocessing.Queue()
|
||||
|
||||
rand_paths = dataset.random_audio_chunk(1)
|
||||
for p in rand_paths:
|
||||
audio_path_queue.put(p)
|
||||
|
||||
print("Files queued")
|
||||
|
||||
processes = [multiprocessing.Process(target=copy_worker, args=(audio_path_queue, audio_queue)) for _ in range(1)]
|
||||
for p in processes: p.start()
|
||||
for p in processes: p.join()
|
||||
|
||||
print("Joined")
|
||||
#for _ in range(1): print(audio_queue.get())
|
||||
Reference in New Issue
Block a user