(prompts, batch_size=1)
| 105 | return None |
| 106 | |
| 107 | def batch_data(prompts, batch_size=1): |
| 108 | batch_data = [] |
| 109 | mini_batch = [] |
| 110 | for prompt in prompts: |
| 111 | mini_batch.append(prompt) |
| 112 | if len(mini_batch) == batch_size: |
| 113 | batch_data.append(mini_batch) |
| 114 | mini_batch = [] |
| 115 | if len(mini_batch) != 0: |
| 116 | batch_data.append(mini_batch) |
| 117 | return batch_data |
| 118 | |
| 119 | def resize_prompt(tokenizer, model_max_context, prompt): |
| 120 |