For the first batch, the model likely has some lazy process to set starting values in the gradients or part of the model not set or reading the text file.
The second point, the input text is blank. So, depending on the model, perhaps it’s stalling due to how the tokenizer or positional embedding is setup. Have you tried putting in the same input("text:") in the first example?
Without seeing the model, it’s tough to know exactly.