For AI beginners, deploying AI software from source code can be challenging. An all-in-one package simplifies this: just download, extract, and double-click to use, significantly lowering the barrier to entry. However, sometimes a ready-made package isn't available, or existing ones aren't updated. In such cases, you can try creating your own all-in-one package and sharing it with others.
AI project models are often very large, and with GPU support, even when compressed into 7z format, the file size can easily exceed 5GB. This makes uploading to cloud storage and local storage difficult. Therefore, I will no longer be creating all-in-one packages myself. If you are interested, you can follow this tutorial to create and share your own.
This tutorial uses F5-TTS as an example to create an all-in-one package on Windows 10 using Python 3.10. The main steps are as follows:
- Download the Python 3.10 embeddable version (not the
.exe
installer, but a.zip
archive). - Install pip and set the dependency lookup path for the project.
- Download F5-TTS source code.
- Install F5-TTS's dependency modules.
- Create a one-click launch script and set the model directory to the project directory.
- Configure proxy access to download models.
- Perform one cloning task to download Whisper and other models.
- Compress into an all-in-one package.
- Creating All-in-One Packages for Other AI Projects
Preparation Before Starting:
First, create an empty folder. To avoid errors, it's recommended to create an English-named folder on a non-system drive, for example, D:\f5win
. This guide will use D:\f5win
. Inside this folder, create another empty folder named runtime
to store the Python 3.10 embeddable version files you'll download later.
Before you begin, please ensure you click "View" in the folder navigation bar and check "File name extensions." Otherwise, subsequent operations may lead to errors, especially for those unfamiliar with file extensions.
1. Download Python 3.10 Embeddable Version
Important Note: You are downloading the embeddable version, not the .exe
installer. This version does not rely on your machine's existing Python environment; even if you have Python installed, you still need to download this specific version.
Download Link: https://www.python.org/downloads/release/python-31011/
Scroll to the bottom of the page and click
Windows embeddable package (64-bit)
to download. This will give you a.zip
archive.Be sure to download this specific version; do not make a mistake!
After downloading, extract the
.zip
archive and copy all its contents into theruntime
folder you created earlier. As shown below:
2. Install pip and Modify Package Search Path
The embeddable version of Python does not include the pip
module, so you need to install it manually.
Install pip:
Open this address: https://bootstrap.pypa.io/get-pip.py
Right-click and "Save as..." to save the file into your
runtime
directory. After saving, theruntime
folder should contain a file namedget-pip.py
.In the address bar of the
runtime
folder, typecmd
and press Enter to open a Command Prompt window (black window).In the Command Prompt window, type the command
.\python get-pip.py
and press Enter. Crucially, ensure the current folder path displayed in the command line is inside theruntime
folder; otherwise, it will cause an error.Wait for the installation to complete...
The
pip
module has been successfully installed!
Modify
python310._pth
file:In the
runtime
folder, find the file namedpython310._pth
, right-click, and open it with Notepad.On the line immediately following the dot symbol
.
on the second line, add the following three lines:./Lib/site-packages ../src ../src/f5_tts
Save the file. The modified file content should look like this. Please double-check for accuracy:
3. Download F5-TTS Source Code
Open the F5-TTS project's GitHub repository: https://github.com/SWivid/F5-TTS
Download the source code as a
.zip
archive.Extract the downloaded
.zip
package. Copy all files from inside theF5-TTS-main
folder into theD:\f5win
folder. Note: Copy the files inside, not the entireF5-TTS-main
folder itself.After extraction, the
D:\f5win
folder contents should look like this:
Back to the previous CMD window
From the same terminal window, execute the
cd ../
command to ensure the path displayed before the command line is nowD:\f5win
(withoutruntime
). All subsequent operations will be performed in theD:\f5win
directory.
4. Install Dependency Modules
Return to the CMD terminal window and reconfirm that the path displayed on the current command line is
D:\f5win
(withoutruntime
).Execute the following command to install dependencies (pay attention to spaces and the dot symbol):
.\runtime\python -m pip install -e .
Wait for the installation to complete...
- If you want the all-in-one package to support NVIDIA graphics cards (optional): Continue by executing the following command to install the CUDA version of PyTorch and torchaudio (pay attention to spaces and the dot symbol; the command must not wrap):
.\runtime\python -m pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
5. Create a One-Click Launch Script
By default, models are saved to the user's directory on the C drive. To simplify packaging, we need to download models directly into the all-in-one package.
- In the
D:\f5win
folder, right-click -> New -> Text Document, create arun.txt
file, open it with Notepad, and enter the following code:
```bat
@echo off
chcp 65001 > nul
set "HF_HOME=%~dp0models"
set "MODELSCOPE_CACHE=%~dp0models"
echo HF_HOME: %HF_HOME%
echo MODELSCOPE_CACHE: %MODELSCOPE_CACHE%
"%~dp0runtime\python" -m f5_tts.infer.infer_gradio --inbrowser
pause
```
The script above means: Save models to the
models
folder within the current directory, then launch the web interface and automatically open it in a browser.
After saving the file, rename
run.txt
torun.bat
. A warning will pop up; select "Yes." If no warning appears, it means you failed to change the extension; please return to the "Preparation Before Starting" section at the top of this article and ensure file extensions are displayed.
6. Configure Proxy Access
Due to network restrictions in some regions, direct access to Hugging Face (huggingface.co) where F5-TTS models are hosted might be blocked. Therefore, you need to configure a proxy access environment and set it as your system proxy.
For example, if your tool is v2ray, you can set it up like this:
Once configured, double-click the run.bat
file you just created.
If double-clicking opens the file with Notepad directly, it means you failed to change the file extension. Please go back to the "Preparation Before Starting" section at the top of this article and select "File name extensions" as instructed.
If double-clicking opens a black window, it will start downloading models to the
D:\f5win\models
folder.If you encounter an error similar to the image below, it indicates that you have not properly configured your proxy access environment or have not set it correctly as a system proxy, preventing connection to Hugging Face for model downloads.
Sometimes, downloads might fail halfway. The most common reason is an unstable proxy node. Please switch to a more stable proxy or node.
Once the models are downloaded, a browser window will automatically open.
7. Perform One Cloning Task to Download Whisper Model
When performing voice cloning without providing the text corresponding to the reference audio, F5-TTS will automatically download the Whisper model from Hugging Face. To ensure a complete package, we need to download it in advance.
In the automatically opened Web window, select a clean 5-10 second reference audio, enter the text you want to synthesize (e.g., "Hello friend"), then click "Synthesize."
This will start downloading the Whisper model.
Once synthesis is successful and no errors occur, you can proceed to package the project into an all-in-one package.
8. Compress into an All-in-One Package
- Before compressing, you can rename
run.bat
toStart_Me.bat
(or点我启动.bat
if you prefer the original Chinese name for some users) to make it easier for new users to understand. - Compress the entire
D:\f5win
folder into a.zip
file, or into a smaller.7z
file. - Share the compressed package with others; they can extract it and double-click
run.bat
(orStart_Me.bat
) to use it.
9. How to Create All-in-One Packages for Other AI Projects
Most Python-based open-source projects on GitHub can be packaged using a similar method. The main differences lie in these three points:
Python Version: Python 3.10 is the most common version and suitable for most projects. If a project has specific requirements (e.g., 3.11 or 3.12), you can find the corresponding
Windows embeddable package (64-bit)
on this page: https://www.python.org/downloads/windows/. It is crucial not to download the.exe
installer.Contents of the
python310._pth
file:./Lib/site-packages
must still be added.- Other paths should be added based on the actual project structure.
- If the project has a code directory named
cfg
, add a line../cfg
. - If the project has a
src
directory containing other subfolders, continue adding../src/foldername
.
Launch Command in the
run.bat
script:- Only this line of command needs to be modified:
"%~dp0runtime\python" -m f5_tts.infer.infer_gradio --inbrowser
- The
"%~dp0runtime\python"
part remains unchanged. The subsequent part should be replaced with the command to launch the respective project (excludingpython
). - If you have doubts, you can provide the content of
run.bat
and the project's launch command to an AI and ask it to generate a new launch script, mimickingrun.bat
. Remember to tell the AI to use the Python interpreter fromrun.bat
.
- Only this line of command needs to be modified: