--- license: apache-2.0 language: - zh tags: - game - honkai_impact - hoyoverse - dialogue - narration size_categories: - 10K 1: break ``` You should see something like this: ``` chapter chapter_id utter_id type role content 0 旧版本宣传CG纪念 0 0-0 narration narration 沧海市东南34公里上空 1 chapter chapter_id ... role content 1 主线1黄昏、少女、战舰 1 ... 踩到附近的地面发光处进行跳跃吧 2 主线1黄昏、少女、战舰 1 ... 琪亚娜 姬子……飞机坏了…… 3 主线1黄昏、少女、战舰 1 ... 姬子 解释的话以后再说。我现在就给你安排新的无人机。 4 主线1黄昏、少女、战舰 1 ... 姬子 沧海市危在旦夕,为了这里的3000万市民—— 5 主线1黄昏、少女、战舰 1 ... 姬子 我们“天命”,必须阻止这艘失控的战舰! .. ... ... ... ... ... 137 主线1黄昏、少女、战舰 1 ... 太好了,你终于醒过来了! 138 主线1黄昏、少女、战舰 1 ... 布洛妮娅…难道刚刚布洛妮娅的芯片失去了控制…… 139 主线1黄昏、少女、战舰 1 ... 通信恢复了?布洛妮娅?你没事吧? 140 主线1黄昏、少女、战舰 1 ... 布洛妮娅没事……但是,在返回学园后,姬子少校,请给布洛妮娅安排全面的身体检查 141 主线1黄昏、少女、战舰 1 ... 布洛妮娅不想再以任何形式,拖大家的后腿了 [141 rows x 6 columns] ``` # VLM Prompt ``` PROMPT = """This is an image of RPG game. Given associated OCR result, please help us identify the existence of story narrations and dialogues and extract them in structured format. This is the associated OCR results: \`\`\`ocr {ocr} \`\`\` There are two types of story content you should extract: - Narration: single line or paragraph of narration, telling the story background and plots - Dialogue: dialogue contents spoken by a character. The speaker character name and spoken content must co-appear in the image. Note: - Be strict with OCR texts, you are NOT allowed to fabricate contents that are not captured by OCR results. - The OCR often separate multiline texts, and it's your task to concatenate consecutive lines if necessary. - There might be noisy textual contents (e.g., advertisement, UI elements, combos, etc.), which are not our interest. - There might be texts indicating state/environment information (e.g., location, time, source, state, etc), you can extract them as well in environment field. Please output your response in JSON structure in one of the 3 following ways: 1. In case of no desired content (neither dialogue nor narration), output a JSON dict whose type is null. \`\`\`json {{"type": null}} \`\`\` 2. In case of dialogue \`\`\`json {{ "type": "dialogue", "role": "", "content": "", "state": "" }} \`\`\` 3. In case of narration \`\`\`json {{ "type": "narration", "content": "" }} \`\`\`""" ``` # VLM code snippet ```python # generate for batch in tqdm(batches): msgs = [ [{"role": "user", "content": [Image.open(b["frame_path"]), format_template(b["ocr"])]}] for b in batch ] outputs = model.chat( image=None, msgs=msgs, tokenizer=tokenizer ) ```