MCPcopy
hub / github.com/Tele-AI/Telechat / end

Method end

models/7B/generation_utils.py:120–128  ·  view source on GitHub ↗

Flushes any remaining cache and prints a newline to stdout.

(self)

Source from the content-addressed store, hash-verified

118 self.on_finalized_text(text)
119
120 def end(self):
121 """Flushes any remaining cache and prints a newline to stdout."""
122 # Flush the cache, if it exists
123 text = ""
124 if len(self.token_cache) > 0:
125 text = self.tokenizer.decode(self.token_cache, **self.decode_kwargs)
126 self.text_until += text
127 self.on_finalized_text(text, stream_end=True)
128 self.clear_cache()
129
130 def clear_cache(self):
131 self.cache_time = 0

Callers

nothing calls this directly

Calls 2

on_finalized_textMethod · 0.95
clear_cacheMethod · 0.95

Tested by

no test coverage detected