C0untFloyd / bark-gui

🔊 Text-Prompted Generative Audio Model with Gradio
MIT License
674 stars 63 forks source link

it's that a dead loop??? #81

Open IronSpiderMan opened 1 year ago

IronSpiderMan commented 1 year ago

i find a piece of code in training_prepare.py, this is the code:

    loop = 1
    while 1:
        filename = uuid.uuid4().hex + '.npy'
        file_name = os.path.join(output, filename)
        text = ''
        while not len(text) > 0:
            text = random_split_chunk(loaded_data)  # Obtain a short chunk of text
            text = text.strip()
        print(f'{loop} Generating semantics for text:', text)
        loop+=1 
        semantics = text_to_semantic(text, temp=round(random.uniform(0.6, 0.8), ndigits=2))
        numpy.save(file_name, semantics)

it's that a dead loop???

IronSpiderMan commented 1 year ago

this the full function:

def prepare_semantics_from_text(num_generations):
    loaded_data = load_books(True)

    use_gpu = not os.environ.get("BARK_FORCE_CPU", False)

    print('Loading semantics model')
    load_model(use_gpu=use_gpu, use_small=False, force_reload=False, model_type='text')

    if not os.path.isdir(output):
        os.mkdir(output)

    loop = 1
    while 1:
        filename = uuid.uuid4().hex + '.npy'
        file_name = os.path.join(output, filename)
        text = ''
        while not len(text) > 0:
            text = random_split_chunk(loaded_data)  # Obtain a short chunk of text
            text = text.strip()
        print(f'{loop} Generating semantics for text:', text)
        loop+=1 
        semantics = text_to_semantic(text, temp=round(random.uniform(0.6, 0.8), ndigits=2))
        numpy.save(file_name, semantics)