MCPcopy Index your code
hub / github.com/Vchitect/Latte / text_preprocessing

Function text_preprocessing

utils.py:318–336  ·  view source on GitHub ↗
(text, clean_caption=False)

Source from the content-addressed store, hash-verified

316)
317
318def text_preprocessing(text, clean_caption=False):
319 if clean_caption and not is_bs4_available():
320 clean_caption = False
321
322 if clean_caption and not is_ftfy_available():
323 clean_caption = False
324
325 if not isinstance(text, (tuple, list)):
326 text = [text]
327
328 def process(text: str):
329 if clean_caption:
330 text = clean_caption(text)
331 text = clean_caption(text)
332 else:
333 text = text.lower().strip()
334 return text
335
336 return [process(t) for t in text]
337
338# Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._clean_caption
339def clean_caption(caption):

Callers

nothing calls this directly

Calls 1

processFunction · 0.85

Tested by

no test coverage detected