facebookresearch / audiocraft

Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.
MIT License
20.59k stars 2.09k forks source link

Windows Installation Guide for Audiocraft to Mitigate Python Environment Issues #71

Open D-Ogi opened 1 year ago

D-Ogi commented 1 year ago

Edit:

I decided to create a repo with a one-click installer using Conda (it installs Miniconda3 automatically), catering to those who might prefer this approach.

https://github.com/D-Ogi/AI-LLM-StableDiffusion-Stuff/tree/main/Audiocraft-Windows-OneClick-Installer

This installer is adapted from bark-gui by C0untFloyd and modified for Audiocraft. It is really one-click where the only question is if the user intends to use CUDA.

This provides another streamlined alternative for installation, and users can choose between your detailed venv tutorial, and this Conda-based one-click installer, based on their preferences and needs.

For those interested in using this one-click installer, simply download the "windows_run_install.bat" file from the repository and run it by double-clicking. The script will handle setting up Conda and other necessary dependencies automatically. It's designed to streamline the installation process, making it more accessible, especially for those who might not be familiar with environment setups.


Issue Description:

Dear maintainers,

I hope this finds you well. I came across a potential enhancement regarding the installation process on Windows that I believe would be beneficial to the community using Stable Diffusion or other AI-related tools.

Problem:

On some Windows setups, I noticed that random installation guides tend to break existing Python installations, which affects Stable Diffusion and other AI tools. This issue seems to be due to the interference between different Python environments.

Proposed Solution:

I've developed a method to install Audiocraft using Conda (specifically Miniconda) and CUDA 11.8 to keep Python environments isolated. I believe incorporating these steps into the official installation guide or documentation would greatly assist Windows users.

Here are the steps I've used:

### Audiocraft Installation Using Miniconda on Windows

#### Step 1: Install Miniconda
Download and install the latest Miniconda using defaults from:
`https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe`

#### Step 2: Open Anaconda Prompt
Type in "Anaconda" or "miniconda" in Windows Start/Search menu and start any of available prompt environments. I personally tend to choose the Powershell one.

#### Step 3: Create and Activate a New Environment
Execute the following commands:
`conda create -n "audiocraft" python=3.9.13 # installs Python 3.9.13`
`conda init #choose bash if asked`
`conda activate audiocraft`

#### Step 4: Install Dependencies and Clone Repo
Execute the following commands:
`conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia`
or `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstall`
or `conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch-nightly -c nvidia`
 `pip install xformers --force-reinstall`
`cd "XXX" # where XXX is a full path to your target folder for Audiocraft (e.g. cd "E:\AI")`
`git clone https://github.com/facebookresearch/audiocraft`
`cd audiocraft`
`pip install -e .`

#### Step 5: Start the Gradio Interface
Execute the following command:
`python app.py`
and click the link that appears in the command prompt (e.g., `https://127.0.0.1:7680`).

### To Start Audiocraft After Installation:

#### Step 1: Open Anaconda Prompt
Type in "anaconda"/"miniconda" in Windows Start/Search menu.

#### Step 2: Navigate to Audiocraft Directory and Activate Environment
Execute the following commands:
`cd "E:\AI\Audiocraft"`
`conda activate audiocraft`

#### Step 3: Start the Gradio Interface
Execute the following command:
`python app.py`
and click the link that appears in the command prompt (e.g., `https://127.0.0.1:7680`).

#### Extra hint: whenever you wish to change Python version, use the command like the one below:
` conda install python=3.10.12`

I kindly request your consideration in integrating these steps into the official installation guide or as part of the documentation to improve the experience for Windows users.

Thank you for your time and effort in maintaining and developing this incredible library.

FurkanGozukara commented 1 year ago

I already have a full tutorial which does venv step by step

With instructions on a github readme

https://youtu.be/v-YpvPkhdO4

D-Ogi commented 1 year ago

Dear @FurkanGozukara,

Thank you for pointing out your detailed tutorial, which includes the use of virtual environments (venv). I watched your video and found it to be thorough and informative. Your tutorial was indeed an inspiration for the method I have shared here.

I wish to highlight that my proposal emphasizes on utilizing Conda environments as an alternative. Conda can offer certain advantages, including a more robust environment isolation, which can be particularly beneficial for complex dependencies. Additionally, the steps I have provided include coverage for the Python 3.9 installation process, which some users might find helpful.

Once again, thank you for your valuable contribution. I believe having multiple approaches, including yours with venv and the Conda-based method I've shared, would enrich the resources available to the community.

FurkanGozukara commented 1 year ago

@D-Ogi ye conda another good alternative I agree. But I find venv better personally

D-Ogi commented 1 year ago

Dear @FurkanGozukara

I appreciate your thoughts on venv, and I agree that personal preferences play a significant role in choosing between Conda and venv. With that in mind, I decided to create a repo with a one-click installer using Conda, catering to those who might prefer this approach.

https://github.com/D-Ogi/AI-LLM-StableDiffusion-Stuff/tree/main/Audiocraft-Windows-OneClick-Installer

This installer is adapted from bark-gui by C0untFloyd and modified for Audiocraft. It is really one-click where the only question is if the user intends to use CUDA.

This provides another streamlined alternative for installation, and users can choose between your detailed venv tutorial, and this Conda-based one-click installer, based on their preferences and needs.

For those interested in using this one-click installer, simply download the "windows_run_install.bat" file from the repository and run it by double-clicking. The script will handle setting up Conda and other necessary dependencies automatically. It's designed to streamline the installation process, making it more accessible, especially for those who might not be familiar with environment setups.

Best regards, D Ogi