From afbecd78b7bffd6c89869f91201792bbf74414c8 Mon Sep 17 00:00:00 2001 From: "Joel Z. Leibo" Date: Sun, 13 Oct 2024 05:44:32 -0700 Subject: [PATCH] together and mistral language model wrappers to no longer delete after last ".". PiperOrigin-RevId: 685414218 Change-Id: I9afa0e49c1610abbe920dd2a5376e7bdc2e08744 --- concordia/language_model/mistral_model.py | 5 +---- concordia/language_model/together_ai.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/concordia/language_model/mistral_model.py b/concordia/language_model/mistral_model.py index 4449a0c..86a2c7c 100644 --- a/concordia/language_model/mistral_model.py +++ b/concordia/language_model/mistral_model.py @@ -126,10 +126,7 @@ def _complete_text( self._channel, {'raw_text_length': len(result)}, ) - # Remove the occasional sentence fragment from the end of the result. - last_stop = result.rfind('.') - if last_stop >= 0: - result = result[:last_stop + 1] + return result def _chat_text( diff --git a/concordia/language_model/together_ai.py b/concordia/language_model/together_ai.py index b8dd39e..4cf098a 100644 --- a/concordia/language_model/together_ai.py +++ b/concordia/language_model/together_ai.py @@ -204,10 +204,7 @@ def sample_text( self._channel, {'raw_text_length': len(result)}, ) - # Remove the occasional sentence fragment from the end of the result. - last_stop = result.rfind('.') - if last_stop >= 0: - result = result[: last_stop + 1] + return result @override