Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DeiantV committed Aug 30, 2023
2 parents 81aa439 + 9986166 commit f3ae1b9
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 2 deletions.
71 changes: 71 additions & 0 deletions colab_for_mdx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import json
import os
import gc
import psutil
import requests
import subprocess
import time
import logging
import sys
import shutil
now_dir = os.getcwd()
sys.path.append(now_dir)
first_cell_executed = False
file_folder = "Colab-for-MDX_B"
def first_cell_ran():
global first_cell_executed
if first_cell_executed:
#print("The 'first_cell_ran' function has already been executed.")
return



first_cell_executed = True
os.makedirs("tmp_models", exist_ok=True)



class hide_opt: # hide outputs
def __enter__(self):
self._original_stdout = sys.stdout
sys.stdout = open(os.devnull, "w")

def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout.close()
sys.stdout = self._original_stdout

def get_size(bytes, suffix="B"): # read ram
global svmem
factor = 1024
for unit in ["", "K", "M", "G", "T", "P"]:
if bytes < factor:
return f"{bytes:.2f}{unit}{suffix}"
bytes /= factor
svmem = psutil.virtual_memory()


def use_uvr_without_saving():
print("Notice: files won't be saved to personal drive.")
print(f"Downloading {file_folder}...", end=" ")
with hide_opt():
#os.chdir(mounting_path)
items_to_move = ["demucs", "diffq","julius","model","separated","tracks","mdx.py","MDX-Net_Colab.ipynb"]
subprocess.run(["git", "clone", "https://github.com/NaJeongMo/Colab-for-MDX_B.git"])
for item_name in items_to_move:
item_path = os.path.join(file_folder, item_name)
if os.path.exists(item_path):
if os.path.isfile(item_path):
shutil.move(item_path, now_dir)
elif os.path.isdir(item_path):
shutil.move(item_path, now_dir)
try:
shutil.rmtree(file_folder)
except PermissionError:
print(f"No se pudo eliminar la carpeta {file_folder}. Puede estar relacionada con Git.")


use_uvr_without_saving()
print("done!")
if not os.path.exists("tracks"):
os.mkdir("tracks")
first_cell_ran()
25 changes: 25 additions & 0 deletions install_Applio.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set "repoUrl=https://github.com/IAHispano/Applio-RVC-Fork/archive/refs/heads/mai
set "repoFolder=Applio-RVC-Fork"
set "fixesFolder=Fixes"
set "localFixesPy=local_fixes.py"
set "colabmdx=colab_for_mdx.py"
set "principal=%cd%\%repoFolder%"
set "URL_BASE=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main"
set "URL_EXTRA=https://huggingface.co/IAHispano/applio/resolve/main"
Expand Down Expand Up @@ -62,6 +63,7 @@ echo Limpiando...
del "%principal%\repo.zip"
echo.
cls
pause

echo Instalando dependencias para ejecutar el archivo Fixes
pip install requests
Expand All @@ -74,6 +76,7 @@ if exist "%fixesFolder%\%localFixesPy%" (
) else (
echo El archivo "%localFixesBat%" no se encontró en la carpeta "Fixes".
)
echo.

echo Pasando a descargar los modelos...
echo.
Expand Down Expand Up @@ -183,6 +186,17 @@ echo.
echo NOTA: El ordenador puede experimentar lentitud durante este proceso; no te preocupes.
echo.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

echo Ejecutando el archivo "%colabmdx%"
echo Verificando si el archivo "%colabmdx%" existe...
if exist "%principal%\%colabmdx%" (
echo Ejecutando el archivo...
python "%principal%\%colabmdx%"
) else (
echo El archivo "%colabmdx%" no se encontró.
)
echo.

endlocal
echo.
cls
Expand All @@ -199,6 +213,17 @@ echo Descargando las dependencias...
echo.
pip install -r requirements.txt
echo.

echo Ejecutando el archivo "%colabmdx%"
echo Verificando si el archivo "%colabmdx%" existe...
if exist "%principal%\%colabmdx%" (
echo Ejecutando el archivo...
python "%principal%\%colabmdx%"
) else (
echo El archivo "%colabmdx%" no se encontró.
)
echo.

echo ¡Applio ha sido descargado!
endlocal
echo.
Expand Down
1 change: 1 addition & 0 deletions requirements-gpu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ librosa==0.9.1
elevenlabs
gTTS==2.3.2
wget
psutil
matplotlib==3.7.2
mega.py==1.0.8
gdown
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ librosa==0.9.1
elevenlabs
gTTS==2.3.2
wget
psutil
matplotlib==3.7.2
mega.py==1.0.8
gdown
Expand Down
14 changes: 12 additions & 2 deletions update_Applio.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ setlocal
:::

set "repoUrl=https://github.com/IAHispano/Applio-RVC-Fork/archive/refs/heads/main.zip"
set "principal=%cd%"
set "fixesFolder=Fixes"
set "localFixesPy=local_fixes.py"
set "subdir=temp_udpate"
set "principal=%cd%"
set "colabmdx=colab_for_mdx.py"
echo.
cls

Expand Down Expand Up @@ -53,8 +54,17 @@ if exist "%fixesFolder%\%localFixesPy%" (
echo El archivo "%localFixesBat%" no se encontró en la carpeta "Fixes".
)

echo Ejecutando el archivo "%colabmdx%"
echo Verificando si el archivo "%colabmdx%" existe...
if exist "%principal%\%colabmdx%" (
echo Ejecutando el archivo...
python "%principal%\%colabmdx%"
) else (
echo El archivo "%colabmdx%" no se encontró.
)

echo Applio ha sido actualizado!
endlocal
echo.
pause
exit
exit

0 comments on commit f3ae1b9

Please sign in to comment.