Update datasets-for-simcse.py
Browse files- datasets-for-simcse.py +5 -7
datasets-for-simcse.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
-
|
3 |
import os
|
4 |
import json
|
5 |
import datasets
|
|
|
6 |
|
7 |
_DESCRIPTION = """datasets-for-simcse"""
|
8 |
|
@@ -55,9 +55,7 @@ class DatasetsForSimCSE(datasets.GeneratorBasedBuilder):
|
|
55 |
|
56 |
def _generate_examples(self, filepath):
|
57 |
"""This function returns the examples in the raw (text) form."""
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
context = {'sent0': sent0, 'sent1': sent1, 'hard_neg': hard_neg}
|
63 |
-
yield idx, context
|
|
|
1 |
# -*- coding: utf-8 -*-
|
|
|
2 |
import os
|
3 |
import json
|
4 |
import datasets
|
5 |
+
import pandas as pd
|
6 |
|
7 |
_DESCRIPTION = """datasets-for-simcse"""
|
8 |
|
|
|
55 |
|
56 |
def _generate_examples(self, filepath):
|
57 |
"""This function returns the examples in the raw (text) form."""
|
58 |
+
df = pd.read_csv(filepath, sep=',')
|
59 |
+
for idx, row in df.iterrows():
|
60 |
+
context = {'sent0': row['sent0'], 'sent1': ['sent1'], 'hard_neg': row['hard_neg']}
|
61 |
+
yield idx, context
|
|
|
|