| --- |
| dataset_info: |
| features: |
| - name: image |
| dtype: image |
| - name: text |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 2227895442 |
| num_examples: 2379 |
| download_size: 2216522714 |
| dataset_size: 2227895442 |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: data/train-* |
| --- |
| |
|
|
|
|
| ```python |
| def remove_ref_tags_except_image_from_sample(sample): |
| """ |
| cleanup the deepseek exrtra tags |
| """ |
| lines = sample["text"].split('\n') |
| filtered_lines = [] |
| |
| for line in lines: |
| # Check if line contains any <|ref|> tag |
| if '<|ref|>' in line: |
| # Keep the line only if it contains <|ref|>image<|/ref|> |
| if '<|ref|>image<|/ref|>' in line: |
| filtered_lines.append(line) |
| else: |
| # Keep lines without <|ref|> tags |
| filtered_lines.append(line) |
| |
| out = '\n'.join(filtered_lines) |
| return {'text':out.strip()} |
| ``` |