Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
|
| 15 |
|
| 16 |
import torch
|
| 17 |
|
| 18 |
-
|
| 19 |
torch.backends.cuda.matmul.allow_tf32 = False
|
| 20 |
torch.backends.cuda.matmul.allow_bf16_reduced_precision_reduction = False
|
| 21 |
torch.backends.cuda.matmul.allow_fp16_reduced_precision_reduction = False
|
|
@@ -26,7 +25,6 @@ torch.backends.cuda.preferred_blas_library="cublas"
|
|
| 26 |
torch.backends.cuda.preferred_linalg_library="cusolver"
|
| 27 |
torch.set_float32_matmul_precision("highest")
|
| 28 |
|
| 29 |
-
|
| 30 |
import torchaudio
|
| 31 |
from einops import rearrange
|
| 32 |
import gradio as gr
|
|
@@ -35,16 +33,7 @@ import gradio as gr
|
|
| 35 |
from stable_audio_tools import get_pretrained_model
|
| 36 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
# Load the model outside of the GPU-decorated function
|
| 41 |
-
def load_model():
|
| 42 |
-
print("Loading model...")
|
| 43 |
-
model, model_config = get_pretrained_model("ford442/stable-audio-open-1.0")
|
| 44 |
-
print("Model loaded successfully.")
|
| 45 |
-
return model, model_config
|
| 46 |
-
|
| 47 |
-
model, model_config = load_model()
|
| 48 |
|
| 49 |
# Function to set up, generate, and process the audio
|
| 50 |
@spaces.GPU(duration=60) # Allocate GPU only when this function is called
|
|
|
|
| 15 |
|
| 16 |
import torch
|
| 17 |
|
|
|
|
| 18 |
torch.backends.cuda.matmul.allow_tf32 = False
|
| 19 |
torch.backends.cuda.matmul.allow_bf16_reduced_precision_reduction = False
|
| 20 |
torch.backends.cuda.matmul.allow_fp16_reduced_precision_reduction = False
|
|
|
|
| 25 |
torch.backends.cuda.preferred_linalg_library="cusolver"
|
| 26 |
torch.set_float32_matmul_precision("highest")
|
| 27 |
|
|
|
|
| 28 |
import torchaudio
|
| 29 |
from einops import rearrange
|
| 30 |
import gradio as gr
|
|
|
|
| 33 |
from stable_audio_tools import get_pretrained_model
|
| 34 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
| 35 |
|
| 36 |
+
model, model_config = get_pretrained_model("ford442/stable-audio-open-1.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Function to set up, generate, and process the audio
|
| 39 |
@spaces.GPU(duration=60) # Allocate GPU only when this function is called
|