more arg creep for demo page

This commit is contained in:
mrq 2024-10-10 19:40:01 -05:00
parent 301468f519
commit 85d85c1351
2 changed files with 5 additions and 3 deletions

View File

@ -36,7 +36,8 @@ from tqdm.auto import tqdm
_logger = logging.getLogger(__name__)
@cache
def get_random_prompts( validation=True, min_length=0, min_duration=6, tokenized=False ):
def get_random_prompts( validation=True, min_length=0, tokenized=False ):
duration_range = [ 5.5, 12.0 ] # to-do: pull from cfg.dataset.duration_range
sentences = [
"The birch canoe slid on the smooth planks.",
"Glue the sheet to the dark blue background.",
@ -91,7 +92,7 @@ def get_random_prompts( validation=True, min_length=0, min_duration=6, tokenized
text_string = metadata["text"] if "text" in metadata else ""
duration = metadata['duration'] if "duration" in metadata else 0
if len( text_string ) < min_length or duration < min_duration:
if len( text_string ) < min_length or not (duration_range[0] <= duration and duration <= duration_range[1]):
continue
sentences.append( text_string )

View File

@ -49,6 +49,7 @@ def main():
parser.add_argument("--dataset-samples", type=int, default=0)
parser.add_argument("--audio-path-root", type=str, default=None)
parser.add_argument("--preamble", type=str, default=None)
parser.add_argument("--output-filename", type=str, default="index.html")
parser.add_argument("--language", type=str, default="en")
@ -249,7 +250,7 @@ def main():
html = html.replace("<th>Our VALL-E</th>", "<th>Our VALL-E (No LoRA)</th>\n\t\t\t\t\t<th>Our VALL-E (LoRA)</th>")
# write demo page
open( args.demo_dir / "index.html", "w", encoding="utf-8" ).write( html )
open( args.demo_dir / args.output_filename, "w", encoding="utf-8" ).write( html )
if __name__ == "__main__":
main()