Kangarroar commited on
Commit
381dbe6
·
1 Parent(s): 26eba56

Delete colab_for_mdx.py

Browse files
Files changed (1) hide show
  1. colab_for_mdx.py +0 -71
colab_for_mdx.py DELETED
@@ -1,71 +0,0 @@
1
- import json
2
- import os
3
- import gc
4
- import psutil
5
- import requests
6
- import subprocess
7
- import time
8
- import logging
9
- import sys
10
- import shutil
11
- now_dir = os.getcwd()
12
- sys.path.append(now_dir)
13
- first_cell_executed = False
14
- file_folder = "Colab-for-MDX_B"
15
- def first_cell_ran():
16
- global first_cell_executed
17
- if first_cell_executed:
18
- #print("The 'first_cell_ran' function has already been executed.")
19
- return
20
-
21
-
22
-
23
- first_cell_executed = True
24
- os.makedirs("tmp_models", exist_ok=True)
25
-
26
-
27
-
28
- class hide_opt: # hide outputs
29
- def __enter__(self):
30
- self._original_stdout = sys.stdout
31
- sys.stdout = open(os.devnull, "w")
32
-
33
- def __exit__(self, exc_type, exc_val, exc_tb):
34
- sys.stdout.close()
35
- sys.stdout = self._original_stdout
36
-
37
- def get_size(bytes, suffix="B"): # read ram
38
- global svmem
39
- factor = 1024
40
- for unit in ["", "K", "M", "G", "T", "P"]:
41
- if bytes < factor:
42
- return f"{bytes:.2f}{unit}{suffix}"
43
- bytes /= factor
44
- svmem = psutil.virtual_memory()
45
-
46
-
47
- def use_uvr_without_saving():
48
- print("Notice: files won't be saved to personal drive.")
49
- print(f"Downloading {file_folder}...", end=" ")
50
- with hide_opt():
51
- #os.chdir(mounting_path)
52
- items_to_move = ["demucs", "diffq","julius","model","separated","tracks","mdx.py","MDX-Net_Colab.ipynb"]
53
- subprocess.run(["git", "clone", "https://github.com/NaJeongMo/Colab-for-MDX_B.git"])
54
- for item_name in items_to_move:
55
- item_path = os.path.join(file_folder, item_name)
56
- if os.path.exists(item_path):
57
- if os.path.isfile(item_path):
58
- shutil.move(item_path, now_dir)
59
- elif os.path.isdir(item_path):
60
- shutil.move(item_path, now_dir)
61
- try:
62
- shutil.rmtree(file_folder)
63
- except PermissionError:
64
- print(f"No se pudo eliminar la carpeta {file_folder}. Puede estar relacionada con Git.")
65
-
66
-
67
- use_uvr_without_saving()
68
- print("done!")
69
- if not os.path.exists("tracks"):
70
- os.mkdir("tracks")
71
- first_cell_ran()