From de8a7c1eb23e46e54ed44d92e60122b881f370d3 Mon Sep 17 00:00:00 2001 From: Christopher Aedo Date: Sun, 7 Jan 2024 07:08:23 -0800 Subject: [PATCH] Adds --no-deepspeed option to disable deepspeed --- epub2tts.py | 13 ++++++++++++- setup.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/epub2tts.py b/epub2tts.py index 59e5d7a..278653b 100644 --- a/epub2tts.py +++ b/epub2tts.py @@ -43,6 +43,7 @@ def __init__( language, skipfootnotes, sayparts, + no_deepspeed, ): self.source = source self.bookname = os.path.splitext(os.path.basename(source))[0] @@ -59,6 +60,7 @@ def __init__( self.chapters = [] self.chapters_to_read = [] self.section_names = [] + self.no_deepspeed = no_deepspeed if source.endswith(".epub"): self.book = epub.read_epub(source) self.sourcetype = "epub" @@ -375,7 +377,10 @@ def read_book(self, voice_samples, engine, openai, model_name, speaker, bitrate) model_json = self.xtts_model + "/config.json" config.load_json(model_json) self.model = Xtts.init_from_config(config) - use_deepspeed = self.is_installed("deepspeed") + if self.no_deepspeed: + use_deepspeed = False + else: + use_deepspeed = self.is_installed("deepspeed") self.model.load_checkpoint( config, checkpoint_dir=self.xtts_model, use_deepspeed=use_deepspeed ) @@ -686,6 +691,11 @@ def main(): type=str, help="Export epub contents to file (txt, md coming soon)" ) + parser.add_argument( + "--no-deepspeed", + action="store_true", + help="Disable deepspeed", + ) args = parser.parse_args() print(args) @@ -706,6 +716,7 @@ def main(): language=args.language, skipfootnotes=args.skipfootnotes, sayparts=args.sayparts, + no_deepspeed=args.no_deepspeed, ) print("Language selected: " + mybook.language) diff --git a/setup.py b/setup.py index f7dedbf..d6c9ed0 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ author_email="doc@aedo.net", url="https://github.com/aedocw/epub2tts", license="Apache License, Version 2.0", - version="2.3.4", + version="2.3.5", packages=find_packages(), install_requires=requirements, py_modules=["epub2tts"],