(self, text, conv, modal_type="image")
| 332 | |
| 333 | |
| 334 | def ask(self, text, conv, modal_type="image"): |
| 335 | assert modal_type in ["text", "image", "video"] |
| 336 | conversations = [] |
| 337 | |
| 338 | if len(conv.messages) > 0 or modal_type == "text": |
| 339 | conv.append_message(conv.roles[0], text) |
| 340 | elif modal_type == "image": |
| 341 | conv.append_message(conv.roles[0], self.image_query + "\n" + text) |
| 342 | else: |
| 343 | conv.append_message(conv.roles[0], self.video_query + "\n" + text) |
| 344 | |
| 345 | conv.append_message(conv.roles[1], None) |
| 346 | conversations.append(conv.get_prompt()) |
| 347 | return conversations |
| 348 | |
| 349 | @torch.no_grad() |
| 350 | def get_image_embedding(self, image_file): |
no test coverage detected