MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / do_induct

Function do_induct

utils/src/experiment/preprocess.py:212–226  ·  view source on GitHub ↗
(llm: list[llms.LLM], ppt_folder: str, rank: int)

Source from the content-addressed store, hash-verified

210 ]
211
212 def do_induct(llm: list[llms.LLM], ppt_folder: str, rank: int):
213 if not older_than(pjoin(ppt_folder, "source.pptx"), wait=wait):
214 return
215 llms.language_model = llm[0]
216 llms.vision_model = llm[1]
217 config = Config(rundir=ppt_folder)
218 ppt_image_folder = pjoin(ppt_folder, "source_slides")
219 template_image_folder = pjoin(ppt_folder, "template_images")
220 image_model = get_image_model(f"cuda:{rank % device_count}")
221 presentation = Presentation.from_file(pjoin(ppt_folder, "source.pptx"), config)
222 ImageLabler(presentation, config).caption_images()
223 slide_inducter = SlideInducter(
224 presentation, ppt_image_folder, template_image_folder, config, image_model
225 )
226 slide_inducter.content_induct()
227
228 for folder in tqdm(sorted(glob.glob("data/*/pptx/*")), desc="prepare induction"):
229 do_induct(induct_llms[induct_id], folder, 0)

Callers 1

prepare_inductionFunction · 0.70

Calls 8

content_inductMethod · 0.95
older_thanFunction · 0.90
ConfigClass · 0.90
get_image_modelFunction · 0.90
ImageLablerClass · 0.90
SlideInducterClass · 0.90
from_fileMethod · 0.45
caption_imagesMethod · 0.45

Tested by

no test coverage detected