From 13bfb90185c0a6d26f14c938963badafc24f1b40 Mon Sep 17 00:00:00 2001 From: Vidalnt Date: Sat, 21 Sep 2024 18:13:21 -0500 Subject: [PATCH] Oops Merge --- .github/workflows/issue_helper.yml | 151 ----------------------------- .github/workflows/pre_colab.yml | 77 --------------- .github/workflows/pre_compiled.yml | 8 +- .github/workflows/release.yml | 6 +- run-install-c.sh | 71 -------------- setup-venv.sh | 23 ----- tabs/settings/fake_gpu.py | 55 ----------- 7 files changed, 7 insertions(+), 384 deletions(-) delete mode 100644 .github/workflows/issue_helper.yml delete mode 100644 .github/workflows/pre_colab.yml delete mode 100644 run-install-c.sh delete mode 100644 setup-venv.sh delete mode 100644 tabs/settings/fake_gpu.py diff --git a/.github/workflows/issue_helper.yml b/.github/workflows/issue_helper.yml deleted file mode 100644 index 700ab8c5..00000000 --- a/.github/workflows/issue_helper.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Issue Management - -on: - issues: - types: [opened, edited] - issue_comment: - types: [created] - -jobs: - check_issue_template: - runs-on: ubuntu-latest - steps: - - name: Check Issue Template - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const issue = context.payload.issue; - const requiredSections = [ - '**Bug Description**', - '**Steps to Reproduce**', - '**Desktop Details:**', - ]; - - const body = issue.body; - const missingFields = requiredSections.filter(section => !body.includes(section)); - - if (missingFields.length > 0) { - const message = `Thank you for your issue report. However, it appears that your issue description is missing the following required sections:\n${missingFields.map(field => `- ${field}`).join('\n')}\n\nPlease edit your issue to include all required information using our issue template. This helps us address your concern more effectively.\nIf you need assistance with the template or have any questions, please join our Discord server for support.\n\nThis issue will be closed automatically. Feel free to reopen it once you've updated it with the required information.`; - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue.number, - body: message - }); - - await github.rest.issues.update({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue.number, - state: 'closed' - }); - } - - auto_reply: - runs-on: ubuntu-latest - needs: check_issue_template - steps: - - name: Generate Response and Post Comment - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const issue = context.payload.issue; - const comment = context.payload.comment; - const repo = context.repo.repo; - const issueNumber = issue.number; - const issueBody = issue.body; - - const groqApiKey = process.env.GROQ_API_KEY; - const issueAuthor = issue.user.login; - const commentAuthor = comment ? comment.user.login : null; - - const systemPrompt = `You are an assistant for a GitHub repository called Applio (https://github.com/IAHispano/Applio), a Python project focused on voice cloning. Your job is to assist users with any issues or bugs they report, providing clear, helpful and short guidance. You can troubleshoot various technical problems and offer solutions, code snippets, or documentation references as needed. Be concise, efficient, and to the point when responding to the following GitHub issue. Try to answer in a paragraph whenever possible and if you are not sure of the answer ask the user for more details. If relevant, refer users to the official documentation at https://docs.applio.org, just share that link, do not add any extension to it. Issue content: ${issueBody}`; - - async function getAIResponse(prompt) { - const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${groqApiKey}`, - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - messages: [ - { role: 'system', content: prompt }, - { role: 'user', content: issueBody }, - ], - model: 'llama-3.1-70b-versatile', - temperature: 0.6, - }), - }); - - if (!response.ok) { - throw new Error('Failed to fetch response from LLM'); - } - - const data = await response.json(); - return data.choices[0].message.content; - } - - const comments = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: repo, - issue_number: issueNumber, - }); - - const discordRecommendation = 'consider joining our support community on [Discord](https://discord.gg/iahispano)'; - const hasDiscordRecommendation = comments.data.some(comment => comment.body.includes(discordRecommendation)); - - if (hasDiscordRecommendation) { - console.log("Discord recommendation already posted. No further responses."); - return; - } - - if (comment) { - if (commentAuthor === issueAuthor) { - const followUpPrompt = `The user has sent another comment. Try to get him to provide more information about his error and try to help him as much as possible precisely and concisely, whenever possible in a paragraph.`; - const aiResponse = await getAIResponse(followUpPrompt); - - const commentMessage = `${aiResponse}\n\nIf you're looking for faster assistance, consider joining our support community on [Discord](https://discord.gg/iahispano), or please wait for a staff member to assist.`; - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: repo, - issue_number: issueNumber, - body: commentMessage, - }); - } - } else { - const initialResponse = await getAIResponse(systemPrompt); - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: repo, - issue_number: issueNumber, - body: initialResponse, - }); - - const followUpMessage = ` - If this issue persists or you need further assistance, please visit our support community at [discord.gg/iahispano](https://discord.gg/iahispano). - Our community is available to help with any additional questions or concerns. - `; - - const hasFollowUpComment = comments.data.some(comment => - comment.body.includes('If this issue persists or you need further assistance') - ); - - if (!hasFollowUpComment) { - setTimeout(async () => { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: repo, - issue_number: issueNumber, - body: followUpMessage, - }); - }, 72 * 60 * 60 * 1000); - } - } - env: - GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} diff --git a/.github/workflows/pre_colab.yml b/.github/workflows/pre_colab.yml deleted file mode 100644 index 521b03dc..00000000 --- a/.github/workflows/pre_colab.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Cache Python Dependencies - -on: - workflow_dispatch: - -jobs: - Linux: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10.12"] - - steps: - - uses: actions/checkout@v3 - - - name: Free up space on runner - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Read version from config.json - id: get-version - run: | - version=$(jq -r '.version' assets/config.json) - echo "version=$version" >> $GITHUB_OUTPUT - - name: Create virtual environment - run: | - sudo apt-get install -y pigz - pip install huggingface_hub - python -m venv .venv - . .venv/bin/activate - python -m ensurepip - python -m pip install "pip<24.1" - python -m pip install -r requirements.txt - python -m pip install torch==2.3.1 torchvision torchaudio --upgrade --index-url https://download.pytorch.org/whl/cu121 - python core.py "prerequisites" --models "True" --exe "False" --pretraineds_v1_f0 "False" --pretraineds_v2_f0 "True" --pretraineds_v1_nof0 "False" --pretraineds_v2_nof0 "False" - find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete - deactivate - rm -f .venv/bin/Activate.ps1 .venv/bin/activate .venv/bin/activate.csh .venv/bin/activate.fish .venv/bin/pip .venv/bin/pip3 .venv/bin/pip3.10 .venv/bin/python .venv/bin/python3 .venv/bin/python3.10 - - - - name: Clean up unnecessary files - run: | - rm -f LICENSE run-tensorboard.bat run-install.bat run-applio.bat run-install.sh requirements.txt .gitignore - rm -rf .github .git - - name: Create Tar file - run: | - tar --warning=no-file-ignored --exclude=ApplioV${{ steps.get-version.outputs.version }}.tar.gz -cf - . | pigz -9 -p 32 > ApplioV${{ steps.get-version.outputs.version }}.tar.gz || true - - name: Upload Linux Compiled - env: - HF_TOKEN: ${{ secrets.HF_TOKEN }} - version: ${{ steps.get-version.outputs.version }} - run: | - python -c " - import os - from huggingface_hub import login, upload_file - - token = os.getenv('HF_TOKEN') - version = os.getenv('version') - login(token) - repo_id = 'vidalnt/nothing' - repo_file_path = f'ApplioV{version}.tar.gz' - - upload_file( - commit_message=f'{version}', - path_or_fileobj=repo_file_path, - path_in_repo=f'Compiled/Linux/ApplioV{version}.tar.gz', - repo_id=repo_id, - token=token) - " - \ No newline at end of file diff --git a/.github/workflows/pre_compiled.yml b/.github/workflows/pre_compiled.yml index 39bc848e..95e37ff7 100644 --- a/.github/workflows/pre_compiled.yml +++ b/.github/workflows/pre_compiled.yml @@ -49,7 +49,7 @@ jobs: token = os.getenv('HF_TOKEN') version = os.getenv('version') login(token) - repo_id = 'vidalnt/nothing' + repo_id = 'IAHispano/Applio' repo_file_path = f'D:/a/Applio/ApplioV{version}.zip' upload_file( @@ -114,7 +114,7 @@ jobs: token = os.getenv('HF_TOKEN') version = os.getenv('version') login(token) - repo_id = 'vidalnt/nothing' + repo_id = 'IAHispano/Applio' repo_file_path = f'ApplioV{version}.zip' upload_file( @@ -182,7 +182,7 @@ jobs: token = os.getenv('HF_TOKEN') version = os.getenv('version') login(token) - repo_id = 'vidalnt/nothing' + repo_id = 'IAHispano/Applio' repo_file_path = 'KaggleV2.tar.gz' upload_file( @@ -316,7 +316,7 @@ jobs: token = os.getenv('HF_TOKEN') version = os.getenv('version') login(token) - repo_id = 'vidalnt/nothing' + repo_id = 'IAHispano/Applio' repo_file_path = 'Pnpur.tar.gz' upload_file( diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f67fb78..58421b87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,7 +127,7 @@ jobs: - name: Install gh-release if: steps.check-version.outputs.tag run: | - npm install https://github.com/Vidalnt/gh-release.git + npm install https://github.com/IAHispano/gh-release.git - name: Create package.json if: steps.check-version.outputs.tag @@ -149,7 +149,7 @@ jobs: changelog=$(cat summarized_changelog.txt) GH_RELEASE_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} npx gh-release \ -t "${tag_name}" \ - -n "Release ${tag_name}" \ + -n "Applio ${tag_name}" \ -c "main" \ -b "## Important Installation Guidelines @@ -173,7 +173,7 @@ jobs: ${changelog} **Full Changelog**: https://github.com/IAHispano/Applio/compare/${{ steps.check-version.outputs.previous-version }}...${{ steps.check-version.outputs.tag }} " \ - -o "Vidalnt" \ + -o "IAHispano" \ -r "Applio" \ -w /home/runner/work/Applio/Applio \ -y diff --git a/run-install-c.sh b/run-install-c.sh deleted file mode 100644 index f50f201e..00000000 --- a/run-install-c.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -printf "\033]0;Applio Installer\007" -clear - -echo "Welcome to the Applio Installer!" -echo - -principal=$(pwd) -CONDA_ROOT_PREFIX="$HOME/Miniconda3" -INSTALL_ENV_DIR="$principal/.venv" -MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-py39_24.7.1-0-Linux-x86_64.sh" -CONDA_EXECUTABLE="$CONDA_ROOT_PREFIX/bin/conda" - -echo "Cleaning up unnecessary files..." -rm -f Makefile Dockerfile docker-compose.yaml *.bat -echo "Cleanup complete." -echo - -if [ ! -f "$CONDA_EXECUTABLE" ]; then - echo "Miniconda not found. Starting download and installation..." - echo "Downloading Miniconda..." - wget -q -O miniconda.sh "$MINICONDA_DOWNLOAD_URL" - if [ ! -f "miniconda.sh" ]; then - echo "Download failed. Please check your internet connection and try again." - exit 1 - fi - - echo "Installing Miniconda..." - bash miniconda.sh -b -p "$CONDA_ROOT_PREFIX" - if [ $? -ne 0 ]; then - echo "Miniconda installation failed." - exit 1 - fi - rm miniconda.sh - echo "Miniconda installation complete." -else - echo "Miniconda already installed. Skipping installation." -fi -echo -"$CONDA_ROOT_PREFIX/bin/conda" update -n base -c conda-forge conda -y -echo "Creating Conda environment..." -"$CONDA_ROOT_PREFIX/bin/conda" create --no-shortcuts -y -k --prefix "$INSTALL_ENV_DIR" python=3.9 -if [ $? -ne 0 ]; then exit 1; fi -echo "Conda environment created successfully." -echo - -if [ -f "$INSTALL_ENV_DIR/bin/python" ]; then - echo "Installing specific pip version..." - "$INSTALL_ENV_DIR/bin/python" -m pip install "pip<24.1" - if [ $? -ne 0 ]; then exit 1; fi - echo "Pip installation complete." - echo -fi - -echo "Installing dependencies..." -ORIGINAL_PATH=$PATH -export PATH="$INSTALL_ENV_DIR/bin:$PATH" -pip install --upgrade setuptools || exit 1 -pip install -r "$principal/requirements.txt" || exit 1 -pip uninstall torch torchvision torchaudio -y -pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121 || exit 1 -echo "Dependencies installation complete." -export PATH=$ORIGINAL_PATH -echo -"$CONDA_ROOT_PREFIX/bin/conda" env export > environment.yml -echo "Applio has been installed successfully!" -echo "To start Applio, please run './run-applio.sh'." -echo - -exit 0 \ No newline at end of file diff --git a/setup-venv.sh b/setup-venv.sh deleted file mode 100644 index ee36d6de..00000000 --- a/setup-venv.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -printf "\033]0;Applio\007" - -echo "Checking for a suitable Python interpreter..." -if command -v python3 > /dev/null 2>&1; then - py=$(which python3) - echo "Using python3 (Note: Python 3.10 is recommended)" -elif command -v python > /dev/null 2>&1; then - py=$(which python) - echo "Using python (Note: Python 3.10 is recommended)" -else - echo "Error: No suitable Python interpreter found. Please install Python 3.10 or a compatible version." - exit 1 -fi - -echo "Recreating virtual environment..." -$py -m venv .venv - -find ".venv" -type f -exec sed -i -e 's/\r$//' -e "s|/home/runner/work/Applio/Applio|$(pwd)|g" -e "s|/.venv/bin/python|/.venv/bin/$(basename $py)|g" {} + -echo "Virtual environment paths fixed." - -echo "Done." \ No newline at end of file diff --git a/tabs/settings/fake_gpu.py b/tabs/settings/fake_gpu.py deleted file mode 100644 index c958e4a4..00000000 --- a/tabs/settings/fake_gpu.py +++ /dev/null @@ -1,55 +0,0 @@ -import os, sys -import torch -import json -import gradio as gr -from assets.i18n.i18n import I18nAuto -from tabs.settings.restart import restart_applio - -now_dir = os.getcwd() -sys.path.append(now_dir) -i18n = I18nAuto() - -ngpu = torch.cuda.device_count() -config_file = os.path.join(now_dir, "assets", "config.json") - - -def gpu_available(): - if torch.cuda.is_available() or ngpu != 0: - return True - - -def load_fake_gpu(): - with open(config_file, "r", encoding="utf8") as file: - config = json.load(file) - return config["fake_gpu"] - - -def save_config(value): - with open(config_file, "r", encoding="utf8") as file: - config = json.load(file) - config["fake_gpu"] = value - with open(config_file, "w", encoding="utf8") as file: - json.dump(config, file, indent=2) - - -def fake_gpu_tab(): - with gr.Row(): - with gr.Column(): - presence = gr.Checkbox( - label=i18n("Enable fake GPU"), - info=i18n( - "Activates the train tab. However, please note that this device lacks GPU capabilities, hence training is not supported. This option is only for testing purposes. (This option will restart Applio)" - ), - interactive=True, - value=load_fake_gpu(), - ) - presence.change( - fn=toggle, - inputs=[presence], - outputs=[], - ) - - -def toggle(checkbox): - save_config(bool(checkbox)) - restart_applio()