Spaces:
Sleeping
Sleeping
Infinitode Pty Ltd
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -44,6 +44,11 @@ def generate_random_name(interpreter, vocab_size, sp, max_length=10, temperature
|
|
44 |
|
45 |
for _ in range(max_length - 1):
|
46 |
token_list = sp.encode_as_ids(generated_name)
|
|
|
|
|
|
|
|
|
|
|
47 |
# Pad to the correct length expected by the model
|
48 |
token_list = custom_pad_sequences([token_list], maxlen=max_seq_len, padding='pre')
|
49 |
|
|
|
44 |
|
45 |
for _ in range(max_length - 1):
|
46 |
token_list = sp.encode_as_ids(generated_name)
|
47 |
+
|
48 |
+
# Handle empty token list case
|
49 |
+
if len(token_list) == 0:
|
50 |
+
continue # Skip the current iteration if the token list is empty
|
51 |
+
|
52 |
# Pad to the correct length expected by the model
|
53 |
token_list = custom_pad_sequences([token_list], maxlen=max_seq_len, padding='pre')
|
54 |
|