mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(txt2img): allow from_file to work with len(lines) < batch_size (#349)
This commit is contained in:
parent
720e5cd651
commit
eef788981c
@ -232,7 +232,12 @@ def main():
|
||||
print(f"reading prompts from {opt.from_file}")
|
||||
with open(opt.from_file, "r") as f:
|
||||
data = f.read().splitlines()
|
||||
data = list(chunk(data, batch_size))
|
||||
if (len(data) >= batch_size):
|
||||
data = list(chunk(data, batch_size))
|
||||
else:
|
||||
while (len(data) < batch_size):
|
||||
data.append(data[-1])
|
||||
data = [data]
|
||||
|
||||
sample_path = os.path.join(outpath, "samples")
|
||||
os.makedirs(sample_path, exist_ok=True)
|
||||
|
Loading…
Reference in New Issue
Block a user