Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fixing colab (part 1) #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import hashlib
import time

LOGS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/logs'
WEIGHTS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/weights'
LOGS_FOLDER = '/content/Mangio-RVC-Tweaks/logs'
WEIGHTS_FOLDER = '/content/Mangio-RVC-Tweaks/weights'
GOOGLE_DRIVE_PATH = '/content/drive/MyDrive/RVC_Backup'

def import_google_drive_backup():
print("Importing Google Drive backup...")
GOOGLE_DRIVE_PATH = '/content/drive/MyDrive/RVC_Backup' # change this to your Google Drive path
LOGS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/logs'
WEIGHTS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/weights'
LOGS_FOLDER = '/content/Mangio-RVC-Tweaks/logs'
WEIGHTS_FOLDER = '/content/Mangio-RVC-Tweaks/weights'
weights_exist = False
for root, dirs, files in os.walk(GOOGLE_DRIVE_PATH):
for filename in files:
Expand Down Expand Up @@ -119,4 +119,4 @@ def backup_files():
with open(last_backup_timestamps_path, 'w') as f:
for filepath, timestamp in last_backup_timestamps.items():
f.write(f'{filepath}:{timestamp}\n')
time.sleep(sleep_time) # wait for 15 seconds before checking again, or 1s if not fully up to date to speed up backups
time.sleep(sleep_time) # wait for 15 seconds before checking again, or 1s if not fully up to date to speed up backups
8 changes: 4 additions & 4 deletions backups_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import hashlib
import time

LOGS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/logs'
WEIGHTS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/weights'
LOGS_FOLDER = '/content/Mangio-RVC-Tweaks/logs'
WEIGHTS_FOLDER = '/content/Mangio-RVC-Tweaks/weights'
GOOGLE_DRIVE_PATH = '/content/drive/MyDrive/RVC_Backup'

def import_google_drive_backup():
print("Importing Google Drive backup...")
GOOGLE_DRIVE_PATH = '/content/drive/MyDrive/RVC_Backup' # change this to your Google Drive path
LOGS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/logs'
WEIGHTS_FOLDER = '/content/Retrieval-based-Voice-Conversion-WebUI/weights'
LOGS_FOLDER = '/content/Mangio-RVC-Tweaks/logs'
WEIGHTS_FOLDER = '/content/Mangio-RVC-Tweaks/weights'
weights_exist = False
files_to_copy = []
weights_to_copy = []
Expand Down
24 changes: 12 additions & 12 deletions clonerepo_experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def edit_file(file_path):
print("No changes were needed.")

# Define the repo path
repo_path = '/content/Retrieval-based-Voice-Conversion-WebUI'
repo_path = '/content/Mangio-RVC-Tweaks'

def copy_all_files_in_directory(src_dir, dest_dir):
# Iterate over all files in source directory
Expand All @@ -115,11 +115,11 @@ def copy_all_files_in_directory(src_dir, dest_dir):

def clone_and_copy_repo(repo_path):
# New repository link
new_repo_link = "https://github.com/alexlnkp/Mangio-RVC-Tweaks/"
new_repo_link = "https://github.com/sonphantrung/Mangio-RVC-Tweaks/"
# Temporary path to clone the repository
temp_repo_path = "/content/temp_Mangio-RVC-Fork"
temp_repo_path = "/content/temp_Mangio-RVC-Tweaks"
# New folder name
new_folder_name = "Mangio-RVC-Fork"
new_folder_name = "Mangio-RVC-Tweaks"

# Clone the latest code from the new repository to a temporary location
run_cmd(f"git clone {new_repo_link} {temp_repo_path}")
Expand All @@ -145,20 +145,20 @@ def clone_and_copy_repo(repo_path):
clone_and_copy_repo(repo_path)

# Download the credentials file for RVC archive sheet
os.makedirs('/content/Retrieval-based-Voice-Conversion-WebUI/stats/', exist_ok=True)
run_cmd("wget -q https://cdn.discordapp.com/attachments/945486970883285045/1114717554481569802/peppy-generator-388800-07722f17a188.json -O /content/Retrieval-based-Voice-Conversion-WebUI/stats/peppy-generator-388800-07722f17a188.json")
os.makedirs('/content/Mangio-RVC-Tweaks/stats/', exist_ok=True)
run_cmd("wget -q https://cdn.discordapp.com/attachments/945486970883285045/1114717554481569802/peppy-generator-388800-07722f17a188.json -O /content/Mangio-RVC-Tweaks/stats/peppy-generator-388800-07722f17a188.json")

# Forcefully delete any existing torchcrepe dependencies downloaded from an earlier run just in case
shutil.rmtree('/content/Retrieval-based-Voice-Conversion-WebUI/torchcrepe', ignore_errors=True)
shutil.rmtree('/content/Mangio-RVC-Tweaks/torchcrepe', ignore_errors=True)
shutil.rmtree('/content/torchcrepe', ignore_errors=True)

# Download the torchcrepe folder from the maxrmorrison/torchcrepe repository
run_cmd("git clone https://github.com/maxrmorrison/torchcrepe.git")
shutil.move('/content/torchcrepe/torchcrepe', '/content/Retrieval-based-Voice-Conversion-WebUI/')
shutil.move('/content/torchcrepe/torchcrepe', '/content/Mangio-RVC-Tweaks/')
shutil.rmtree('/content/torchcrepe', ignore_errors=True) # Delete the torchcrepe repository folder

# Change the current directory to /content/Retrieval-based-Voice-Conversion-WebUI
os.chdir('/content/Retrieval-based-Voice-Conversion-WebUI')
# Change the current directory to /content/Mangio-RVC-Tweaks
os.chdir('/content/Mangio-RVC-Tweaks')
os.makedirs('pretrained', exist_ok=True)
os.makedirs('uvr5_weights', exist_ok=True)

Expand Down Expand Up @@ -194,7 +194,7 @@ def download_pretrained_models():
}

base_url = "https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/"
base_path = "/content/Retrieval-based-Voice-Conversion-WebUI/"
base_path = "/content/Mangio-RVC-Tweaks/"

# Calculate total number of files to download
total_files = sum(len(files) for files in pretrained_models.values()) + 1 # +1 for hubert_base.pt
Expand All @@ -219,4 +219,4 @@ def clone_repository(run_download):
with ThreadPoolExecutor(max_workers=2) as executor:
executor.submit(run_script)
if run_download:
executor.submit(download_pretrained_models)
executor.submit(download_pretrained_models)