Update README.md
Browse files
README.md
CHANGED
|
@@ -17,3 +17,27 @@ configs:
|
|
| 17 |
- split: train
|
| 18 |
path: data/train-*
|
| 19 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
- split: train
|
| 18 |
path: data/train-*
|
| 19 |
---
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
def remove_ref_tags_except_image_from_sample(sample):
|
| 25 |
+
"""
|
| 26 |
+
cleanup the deepseek exrtra tags
|
| 27 |
+
"""
|
| 28 |
+
lines = sample["text"].split('\n')
|
| 29 |
+
filtered_lines = []
|
| 30 |
+
|
| 31 |
+
for line in lines:
|
| 32 |
+
# Check if line contains any <|ref|> tag
|
| 33 |
+
if '<|ref|>' in line:
|
| 34 |
+
# Keep the line only if it contains <|ref|>image<|/ref|>
|
| 35 |
+
if '<|ref|>image<|/ref|>' in line:
|
| 36 |
+
filtered_lines.append(line)
|
| 37 |
+
else:
|
| 38 |
+
# Keep lines without <|ref|> tags
|
| 39 |
+
filtered_lines.append(line)
|
| 40 |
+
|
| 41 |
+
out = '\n'.join(filtered_lines)
|
| 42 |
+
return {'text':out.strip()}
|
| 43 |
+
```
|