Spaces:
Sleeping
Sleeping
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -51,7 +51,7 @@ r'''############################################################################
|
|
| 51 |
|
| 52 |
###################################################################################
|
| 53 |
|
| 54 |
-
__version__ = "25.
|
| 55 |
|
| 56 |
print('=' * 70)
|
| 57 |
print('TMIDIX Python module')
|
|
@@ -11407,21 +11407,27 @@ def escore_notes_core(escore_notes, core_len=128):
|
|
| 11407 |
|
| 11408 |
###################################################################################
|
| 11409 |
|
| 11410 |
-
def multiprocessing_wrapper(function,
|
|
|
|
|
|
|
|
|
|
| 11411 |
|
| 11412 |
-
|
| 11413 |
-
|
| 11414 |
-
|
| 11415 |
-
|
| 11416 |
-
|
| 11417 |
-
|
| 11418 |
-
|
| 11419 |
-
|
| 11420 |
-
|
|
|
|
|
|
|
| 11421 |
results.append(result)
|
| 11422 |
-
|
| 11423 |
return results
|
| 11424 |
|
|
|
|
| 11425 |
###################################################################################
|
| 11426 |
|
| 11427 |
def rle_encode_ones(matrix, div_mod=-1):
|
|
@@ -11604,9 +11610,10 @@ def create_files_list(datasets_paths=['./'],
|
|
| 11604 |
|
| 11605 |
for dataset_addr in datasets_paths:
|
| 11606 |
|
| 11607 |
-
|
| 11608 |
-
|
| 11609 |
-
|
|
|
|
| 11610 |
|
| 11611 |
for dirpath, dirnames, filenames in tqdm.tqdm(os.walk(dataset_addr), disable=not verbose):
|
| 11612 |
|
|
|
|
| 51 |
|
| 52 |
###################################################################################
|
| 53 |
|
| 54 |
+
__version__ = "25.12.29"
|
| 55 |
|
| 56 |
print('=' * 70)
|
| 57 |
print('TMIDIX Python module')
|
|
|
|
| 11407 |
|
| 11408 |
###################################################################################
|
| 11409 |
|
| 11410 |
+
def multiprocessing_wrapper(function,
|
| 11411 |
+
data_list,
|
| 11412 |
+
num_workers=None,
|
| 11413 |
+
verbose=True):
|
| 11414 |
|
| 11415 |
+
if num_workers is None:
|
| 11416 |
+
num_workers = multiprocessing.cpu_count()
|
| 11417 |
+
|
| 11418 |
+
results = []
|
| 11419 |
+
|
| 11420 |
+
with multiprocessing.Pool(processes=num_workers) as pool:
|
| 11421 |
+
for result in tqdm.tqdm(
|
| 11422 |
+
pool.imap(function, data_list),
|
| 11423 |
+
total=len(data_list),
|
| 11424 |
+
disable=not verbose
|
| 11425 |
+
):
|
| 11426 |
results.append(result)
|
| 11427 |
+
|
| 11428 |
return results
|
| 11429 |
|
| 11430 |
+
|
| 11431 |
###################################################################################
|
| 11432 |
|
| 11433 |
def rle_encode_ones(matrix, div_mod=-1):
|
|
|
|
| 11610 |
|
| 11611 |
for dataset_addr in datasets_paths:
|
| 11612 |
|
| 11613 |
+
if verbose:
|
| 11614 |
+
print('=' * 70)
|
| 11615 |
+
print('Processing', dataset_addr)
|
| 11616 |
+
print('=' * 70)
|
| 11617 |
|
| 11618 |
for dirpath, dirnames, filenames in tqdm.tqdm(os.walk(dataset_addr), disable=not verbose):
|
| 11619 |
|