Skip to content

PythonHashseed error solved #992

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TalhaFaredi
Copy link

Resolved the retraining issue caused by Pythonhashseed error. Previously, the model would throw an error during consecutive training sessions. Now, users can retrain the model multiple times within the same session without any issues.

Solved the retrain error of Python Hashseed
@SWivid
Copy link
Owner

SWivid commented Apr 23, 2025

Hi @TalhaFaredi could you provide the detailed error message? And also some explanations for "consecutive training sessions" since no previous report of such an error.

The current version is done explicitly like:

os.environ["PYTHONHASHSEED"] = str(seed)

@TalhaFaredi
Copy link
Author

TalhaFaredi commented Apr 23, 2025

Consecutive training sessions refers to where a model performs well during the initial training. However, if a user attempts to create a new project within the same running application and try to train it as well, it results in an error. This issue is temporarily resolved by restarting the app. After restarting, fine-tuning typically works again — but only for the first attempt. The Attached Screenshoot is the error at current time

Screenshot 2025-04-23 164809

The Detailed error is below

Generating audio in 1 batches...
100% 1/1 [00:03<00:00, 3.61s/it]
/usr/local/lib/python3.11/dist-packages/transformers/models/whisper/generation_whisper.py:573: FutureWarning: The input name inputs is deprecated. Please make sure to use input_features instead.
warnings.warn(
run command :
accelerate launch --mixed_precision=fp16 /content/F5-TTS/src/f5_tts/train/finetune_cli.py --exp_name F5TTS_v1_Base --learning_rate 1e-05 --batch_size_per_gpu 3200 --batch_size_type frame --max_samples 64 --grad_accumulation_steps 1 --max_grad_norm 1 --epochs 1 --num_warmup_updates 100 --save_per_updates 500 --keep_last_n_checkpoints -1 --last_per_updates 100 --dataset_name my_speak2 --finetune --tokenizer pinyin --log_samples

Fatal Python error: config_init_hash_seed: PYTHONHASHSEED must be "random" or an integer in range [0; 4294967295]
Python runtime state: preinitialized

@SWivid
Copy link
Owner

SWivid commented Apr 23, 2025

I just test with same running gradio application (no restart)

Create 1st project -> train -> stop train (pause)
Create 2nd project -> train -> stop train (pause)

Nothing wrong.

Maybe you could provide detailed process about how to reproduce your error (describe every step you done)

@TalhaFaredi
Copy link
Author

First I Go to Google Colab
Cloned Repo and install dependencies then run finetune gradio with '' --share''

  1. Create a Project Upload a Voice i am unisng a Spanish Voice then Prepare data
  2. after that you can select the default model run 1 epoch and see when training finishes
  3. after that test it (optional)
  4. create a new project or select the same project and then prepare data after that run train you will see the error

It took a lot to solve , i have tested it on colab and amazon ec2 with same error but after my solution it works perfect

@SWivid
Copy link
Owner

SWivid commented Apr 23, 2025

after that you can select the default model run 1 epoch and see when training finishes

Have you waited for a short training finished or clicked on "Stop Training" or just left it training there?

@SWivid
Copy link
Owner

SWivid commented Apr 23, 2025

try print out os.environ["PYTHONHASHSEED"] or do echo on cmd before accelerate .... line
need to figure out the blocking point (iot to make consistent performance with previous version, otherwise PYTHONHASHSEED not fixed)

@TalhaFaredi
Copy link
Author

I have Already printed PYTHONHASHSEED value and trying echo that. Main issue was that after training the Hashseed value didn't updated , so i set the value while sending it to cli file . and it works really well and retraining starts

@SWivid
Copy link
Owner

SWivid commented Apr 25, 2025

so what is the value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants