Browse Source

Remove SOX

Pallaidium_MacOS
tin2tin 12 months ago committed by GitHub
parent
commit
97a653493e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 42
      __init__.py

42
__init__.py

@ -673,15 +673,17 @@ def install_modules(self):
import_module(self, "huggingface_hub", "huggingface_hub") import_module(self, "huggingface_hub", "huggingface_hub")
import_module(self, "accelerate", "git+https://github.com/huggingface/accelerate.git") import_module(self, "accelerate", "git+https://github.com/huggingface/accelerate.git")
#import_module(self, "transformers", "git+https://github.com/huggingface/transformers") #import_module(self, "transformers", "git+https://github.com/huggingface/transformers.git")
subprocess.check_call([pybin, "-m", "pip", "install", "transformers", "--upgrade"]) subprocess.check_call([pybin, "-m", "pip", "install", "git+https://github.com/huggingface/transformers.git", "--upgrade"])
#subprocess.check_call([pybin, "-m", "pip", "install", "transformers", "--upgrade"])
import_module(self, "bark", "git+https://github.com/suno-ai/bark.git")
#import_module(self, "bark", "git+https://github.com/suno-ai/bark.git") #import_module(self, "bark", "git+https://github.com/suno-ai/bark.git")
import_module(self, "diffusers", "diffusers") import_module(self, "diffusers", "diffusers")
#import_module(self, "diffusers", "git+https://github.com/huggingface/diffusers.git@v0.22.3") #import_module(self, "diffusers", "git+https://github.com/huggingface/diffusers.git@v0.22.3")
import_module(self, "tensorflow", "tensorflow") import_module(self, "tensorflow", "tensorflow")
if os_platform == "Darwin" or os_platform == "Linux": # if os_platform == "Darwin" or os_platform == "Linux":
import_module(self, "sox", "sox") # import_module(self, "sox", "sox")
else: # else:
import_module(self, "soundfile", "PySoundFile") import_module(self, "soundfile", "PySoundFile")
#import_module(self, "transformers", "transformers") #import_module(self, "transformers", "transformers")
import_module(self, "sentencepiece", "sentencepiece") import_module(self, "sentencepiece", "sentencepiece")
@ -880,9 +882,9 @@ class GENERATOR_OT_uninstall(Operator):
uninstall_module_with_dependencies("torchvision") uninstall_module_with_dependencies("torchvision")
uninstall_module_with_dependencies("torchaudio") uninstall_module_with_dependencies("torchaudio")
if os_platform == "Darwin" or os_platform == "Linux": # if os_platform == "Darwin" or os_platform == "Linux":
uninstall_module_with_dependencies("sox") # uninstall_module_with_dependencies("sox")
else: # else:
uninstall_module_with_dependencies("PySoundFile") uninstall_module_with_dependencies("PySoundFile")
uninstall_module_with_dependencies("diffusers") uninstall_module_with_dependencies("diffusers")
uninstall_module_with_dependencies("accelerate") uninstall_module_with_dependencies("accelerate")
@ -1861,6 +1863,7 @@ class SEQUENCER_OT_generate_movie(Operator):
vae = AutoencoderKL.from_pretrained( vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16 "madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16
) )
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained( pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
movie_model_card, movie_model_card,
@ -1997,6 +2000,7 @@ class SEQUENCER_OT_generate_movie(Operator):
else: else:
from diffusers import TextToVideoSDPipeline from diffusers import TextToVideoSDPipeline
import torch
pipe = TextToVideoSDPipeline.from_pretrained( pipe = TextToVideoSDPipeline.from_pretrained(
movie_model_card, movie_model_card,
@ -2367,9 +2371,9 @@ class SEQUENCER_OT_generate_audio(Operator):
import xformers import xformers
if addon_prefs.audio_model_card == "facebook/musicgen-stereo-small": if addon_prefs.audio_model_card == "facebook/musicgen-stereo-small":
if os_platform == "Darwin" or os_platform == "Linux": # if os_platform == "Darwin" or os_platform == "Linux":
import sox # import sox
else: # else:
import soundfile as sf import soundfile as sf
if addon_prefs.audio_model_card == "bark": if addon_prefs.audio_model_card == "bark":
@ -2519,14 +2523,14 @@ class SEQUENCER_OT_generate_audio(Operator):
filename = solve_path(clean_filename(str(seed)+"_"+prompt) + ".wav") filename = solve_path(clean_filename(str(seed)+"_"+prompt) + ".wav")
rate = 48000 rate = 48000
if os_platform == "Darwin" or os_platform == "Linux": # if os_platform == "Darwin" or os_platform == "Linux":
tfm = sox.Transformer() # tfm = sox.Transformer()
tfm.build_file( # tfm.build_file(
input_array=music["audio"][0].T, # input_array=music["audio"][0].T,
sample_rate_in=music["sampling_rate"], # sample_rate_in=music["sampling_rate"],
output_filepath=filename # output_filepath=filename
) # )
else: # else:
sf.write(filename, music["audio"][0].T, music["sampling_rate"]) sf.write(filename, music["audio"][0].T, music["sampling_rate"])
elif addon_prefs.audio_model_card == "declare-lab/mustango": elif addon_prefs.audio_model_card == "declare-lab/mustango":

Loading…
Cancel
Save