Spaces:
Paused
Paused
이 풀 리퀘스트를 사용하면 모든 오디오 세대가 서로 다를 수 있습니다./This PR makes each generation different
#1
by
Fabrice-TIERCELIN
- opened
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import torchaudio
|
| 3 |
from einops import rearrange
|
|
@@ -30,6 +31,11 @@ def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
|
|
| 30 |
translated_prompt = translator(prompt, max_length=512)[0]['translation_text']
|
| 31 |
print(f"Translated Prompt: {translated_prompt}")
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 34 |
print(f"Using device: {device}")
|
| 35 |
|
|
|
|
| 1 |
+
import random
|
| 2 |
import torch
|
| 3 |
import torchaudio
|
| 4 |
from einops import rearrange
|
|
|
|
| 31 |
translated_prompt = translator(prompt, max_length=512)[0]['translation_text']
|
| 32 |
print(f"Translated Prompt: {translated_prompt}")
|
| 33 |
|
| 34 |
+
seed = random.randint(0, 2**63 - 1)
|
| 35 |
+
random.seed(seed)
|
| 36 |
+
torch.manual_seed(seed)
|
| 37 |
+
print(f"Using seed: {seed}")
|
| 38 |
+
|
| 39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 40 |
print(f"Using device: {device}")
|
| 41 |
|