(self, data, num_images)
| 222 | return data_paths |
| 223 | |
| 224 | def change_format(self, data, num_images): |
| 225 | elements = [] |
| 226 | for conversation in data['conversations']: |
| 227 | if conversation['from'] == 'human': |
| 228 | if '<image>' not in conversation['value']: |
| 229 | elements.append({ |
| 230 | 'type': 'text', |
| 231 | 'has_loss': 0, |
| 232 | 'text': conversation['value'], |
| 233 | }) |
| 234 | else: |
| 235 | |
| 236 | text_list = conversation['value'].split('<image>') |
| 237 | for idx, text in enumerate(text_list): |
| 238 | if text.strip() != '': |
| 239 | elements.append({ |
| 240 | 'type': 'text', |
| 241 | 'has_loss': 0, |
| 242 | 'text': text.strip(), |
| 243 | }) |
| 244 | if (idx != len(text_list) - 1) and (idx < num_images): |
| 245 | elements.append({'type': 'image',}) |
| 246 | elif conversation['from'] == 'gpt': |
| 247 | elements.append({ |
| 248 | 'type': 'text', |
| 249 | 'has_loss': 1, |
| 250 | 'text': conversation['value'], |
| 251 | }) |
| 252 | return elements |
| 253 | |
| 254 | def _crop_resize_if_necessary(self, image, depthmap, intrinsics, resolution, rng=None, info=None, normal=None, far_mask=None): |
| 255 | """ This function: |
nothing calls this directly
no outgoing calls
no test coverage detected