Skip to content

Commit

Permalink
Revert "Delete All Again"
Browse files Browse the repository at this point in the history
This reverts commit a47df91.
  • Loading branch information
DeiantV committed Aug 24, 2023
1 parent a47df91 commit ab2a570
Show file tree
Hide file tree
Showing 173 changed files with 30,967 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.DS_Store
__pycache__
/TEMP
/DATASETS
/RUNTIME
*.pyd
hubert_base.pt
.venv
alexforkINSTALL.bat
Changelog_CN.md
Changelog_EN.md
Changelog_KO.md
difdep.py
EasierGUI.py
envfilescheck.bat
export_onnx.py
export_onnx_old.py
ffmpeg.exe
ffprobe.exe
Fixes/Launch_Tensorboard.bat
Fixes/LOCAL_CREPE_FIX.bat
Fixes/local_fixes.py
Fixes/tensor-launch.py
gui.py
infer-web backup.py
infer-webbackup.py
install_easy_dependencies.py
install_easyGUI.bat
installstft.bat
Launch_Tensorboard.bat
listdepend.bat
LOCAL_CREPE_FIX.bat
local_fixes.py
oldinfer.py
onnx_inference_demo.py
Praat.exe
requirementsNEW.txt
rmvpe.pt
run_easiergui.bat
tensor-launch.py
values1.json
使用需遵守的协议-LICENSE.txt
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1

FROM python:3.10-bullseye

EXPOSE 7865

WORKDIR /app

COPY . .

RUN pip3 install -r requirements.txt

CMD ["python3", "infer-web.py"]
144 changes: 144 additions & 0 deletions Fixes/local_fixes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import os
import sys
import time
import shutil
import requests
import zipfile

file_name2 = 'go-web.bat'
text_to_insert2 = """python infer-web.py --pycmd runtime\python.exe --port 7897
pause"""

with open(file_name2, 'w') as archivo:
archivo.write(text_to_insert2)
print(f"Se ha modificado el contenido de '{file_name2}'.")

def insert_new_line(file_name, line_to_find, text_to_insert):
lines = []
with open(file_name, 'r', encoding='utf-8') as read_obj:
lines = read_obj.readlines()
already_exists = False
with open(file_name + '.tmp', 'w', encoding='utf-8') as write_obj:
for i in range(len(lines)):
write_obj.write(lines[i])
if lines[i].strip() == line_to_find:
# If next line exists and starts with sys.path.append, skip
if i+1 < len(lines) and lines[i+1].strip().startswith("sys.path.append"):
print('¡Ya estaba arreglado! Se salta añadir una línea...')
already_exists = True
break
else:
write_obj.write(text_to_insert + '\n')
# If no existing sys.path.append line was found, replace the original file
if not already_exists:
os.replace(file_name + '.tmp', file_name)
return True
else:
# If existing line was found, delete temporary file
os.remove(file_name + '.tmp')
return False

def replace_in_file(file_name, old_text, new_text):
with open(file_name, 'r', encoding='utf-8') as file:
file_contents = file.read()

if old_text in file_contents:
file_contents = file_contents.replace(old_text, new_text)
with open(file_name, 'w', encoding='utf-8') as file:
file.write(file_contents)
return True

return False

if __name__ == "__main__":
current_path = os.getcwd()
file_name = 'extract_f0_print.py'
line_to_find = 'import numpy as np, logging'
text_to_insert = "sys.path.append(r'" + current_path + "')"


success_1 = insert_new_line(file_name, line_to_find, text_to_insert)
if success_1:
print('¡La primera operación fue un éxito!')
else:
print('¡Se saltó la primera operación porque ya estaba arreglada!')

file_name = 'infer-web.py'
old_text = 'with gr.Blocks(theme=gr.themes.Soft()) as app:'
new_text = 'with gr.Blocks() as app:'

success_2 = replace_in_file(file_name, old_text, new_text)
if success_2:
print('¡La segunda operación fue un éxito!')
else:
print('¡La segunda operación se omitió porque ya estaba arreglada!')

print('¡Correcciones locales exitosas! Ahora debería poder inferir y entrenar localmente en Applio RVC Fork.')

time.sleep(5)

def find_torchcrepe_directory(directory):
"""
Busca recursivamente la carpeta de mayor jerarquía denominada 'torchcrepe' dentro de un directorio.
Devuelve la ruta del directorio encontrado o Ninguno si no se encuentra.
"""
for root, dirs, files in os.walk(directory):
if 'torchcrepe' in dirs:
return os.path.join(root, 'torchcrepe')
return None

def download_and_extract_torchcrepe():
url = 'https://github.com/maxrmorrison/torchcrepe/archive/refs/heads/master.zip'
temp_dir = 'temp_torchcrepe'
destination_dir = os.getcwd()

try:
torchcrepe_dir_path = os.path.join(destination_dir, 'torchcrepe')

if os.path.exists(torchcrepe_dir_path):
print("Saltando la descarga de torchcrepe. La carpeta ya existe.")
return

# Download the file
print("Iniciando la descarga de torchcrepe...")
response = requests.get(url)

# Raise an error if the GET request was unsuccessful
response.raise_for_status()
print("Descarga finalizada.")

# Save the downloaded file
zip_file_path = os.path.join(temp_dir, 'master.zip')
os.makedirs(temp_dir, exist_ok=True)
with open(zip_file_path, 'wb') as file:
file.write(response.content)
print(f"Archivo zip guardado en {zip_file_path}")

# Extract the zip file
print("Extrayendo contenidos...")
with zipfile.ZipFile(zip_file_path, 'r') as zip_file:
zip_file.extractall(temp_dir)
print("Extracción finalizada.")

# Locate the torchcrepe folder and move it to the destination directory
torchcrepe_dir = find_torchcrepe_directory(temp_dir)
if torchcrepe_dir:
shutil.move(torchcrepe_dir, destination_dir)
print(f"Se movió el directorio torchcrepe a {destination_dir}!")
else:
print("No se pudo localizar el directorio de torchcrepe.")

except Exception as e:
print("Torchcrepe no descargado con éxito?", e)

# Clean up temporary directory
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir)

# Run the function
download_and_extract_torchcrepe()

temp_dir = 'temp_torchcrepe'

if os.path.exists(temp_dir):
shutil.rmtree(temp_dir)
15 changes: 15 additions & 0 deletions Fixes/tensor-launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import threading
import time
from tensorboard import program
import os

log_path = "logs"

if __name__ == "__main__":
tb = program.TensorBoard()
tb.configure(argv=[None, '--logdir', log_path])
url = tb.launch()
print(f'Tensorboard can be accessed at: {url}')

while True:
time.sleep(600) # Keep the main thread running
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2023 liujing04
Copyright (c) 2023 源文雨

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions LazyImport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from importlib.util import find_spec, LazyLoader, module_from_spec
from sys import modules

def lazyload(name):
if name in modules:
return modules[name]
else:
spec = find_spec(name)
loader = LazyLoader(spec.loader)
module = module_from_spec(spec)
modules[name] = module
loader.exec_module(module)
return module
Loading

0 comments on commit ab2a570

Please sign in to comment.