Update modeling_florence2.py
Browse files- modeling_florence2.py +2 -3
modeling_florence2.py
CHANGED
@@ -3021,7 +3021,6 @@ class Florence2ForConditionalGeneration(Florence2PreTrainedModel):
|
|
3021 |
continue
|
3022 |
|
3023 |
# if, however, there is a deviation find the maximum prefix that matches in the batch
|
3024 |
-
# import pdb; pdb.set_trace()
|
3025 |
|
3026 |
predicted_next_tokens = predicted_next_tokens[:, 0]
|
3027 |
predicted_next_token_strings = processor.batch_decode(predicted_next_tokens)
|
@@ -3033,8 +3032,8 @@ class Florence2ForConditionalGeneration(Florence2PreTrainedModel):
|
|
3033 |
running_indices[i] += 1
|
3034 |
if running_indices[i] >= decoder_input_ids.shape[1]:
|
3035 |
next_tokens_to_concat.append(torch.tensor(processor.tokenizer.eos_token_id, device=self.device))
|
3036 |
-
elif "’" in pnts:
|
3037 |
-
|
3038 |
else:
|
3039 |
next_tokens_to_concat.append(decoder_input_ids[i, running_indices[i]])
|
3040 |
next_tokens_to_concat = torch.stack(next_tokens_to_concat)[:, None]
|
|
|
3021 |
continue
|
3022 |
|
3023 |
# if, however, there is a deviation find the maximum prefix that matches in the batch
|
|
|
3024 |
|
3025 |
predicted_next_tokens = predicted_next_tokens[:, 0]
|
3026 |
predicted_next_token_strings = processor.batch_decode(predicted_next_tokens)
|
|
|
3032 |
running_indices[i] += 1
|
3033 |
if running_indices[i] >= decoder_input_ids.shape[1]:
|
3034 |
next_tokens_to_concat.append(torch.tensor(processor.tokenizer.eos_token_id, device=self.device))
|
3035 |
+
# elif "’" in pnts: # this is an annoying character which looks like ' (apostrophe) but isn't.
|
3036 |
+
# import pdb; pdb.set_trace()
|
3037 |
else:
|
3038 |
next_tokens_to_concat.append(decoder_input_ids[i, running_indices[i]])
|
3039 |
next_tokens_to_concat = torch.stack(next_tokens_to_concat)[:, None]
|