fixed bug
Browse files- ref_seg_ger.py +6 -6
ref_seg_ger.py
CHANGED
|
@@ -205,10 +205,10 @@ class RefSeg(datasets.GeneratorBasedBuilder):
|
|
| 205 |
#print(filepath)
|
| 206 |
#print(split)
|
| 207 |
paths = glob(filepath + '/' + split + '/*.csv')
|
| 208 |
-
print(paths)
|
| 209 |
key = 0
|
| 210 |
for f in paths:
|
| 211 |
-
print(f)
|
| 212 |
df = pd.read_csv(f)
|
| 213 |
input_ids = []
|
| 214 |
labels = []
|
|
@@ -237,7 +237,7 @@ class RefSeg(datasets.GeneratorBasedBuilder):
|
|
| 237 |
input_ids.append(input_id)
|
| 238 |
labels.append('O')
|
| 239 |
elif len(tokenized_input['input_ids']) == 1:
|
| 240 |
-
input_ids.append(tokenized_input['input_ids'])
|
| 241 |
if row['tag'] == 'O':
|
| 242 |
labels.append(row['tag'])
|
| 243 |
else:
|
|
@@ -245,15 +245,15 @@ class RefSeg(datasets.GeneratorBasedBuilder):
|
|
| 245 |
else:
|
| 246 |
continue
|
| 247 |
|
| 248 |
-
print('got all')
|
| 249 |
for chunk_id, index in enumerate(range(0, len(input_ids), self.CHUNK_SIZE)):
|
| 250 |
split_ids = input_ids[index:max(len(input_ids), index + self.CHUNK_SIZE)]
|
| 251 |
#split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
|
| 252 |
# split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
|
| 253 |
# split_fonts = fonts[index:index + self.CHUNK_SIZE]
|
| 254 |
split_labels = labels[index:max(len(input_ids), index + self.CHUNK_SIZE)]
|
| 255 |
-
print(split_labels, len(split_labels))
|
| 256 |
-
print(split_ids, len(split_ids))
|
| 257 |
|
| 258 |
|
| 259 |
yield key, {
|
|
|
|
| 205 |
#print(filepath)
|
| 206 |
#print(split)
|
| 207 |
paths = glob(filepath + '/' + split + '/*.csv')
|
| 208 |
+
#print(paths)
|
| 209 |
key = 0
|
| 210 |
for f in paths:
|
| 211 |
+
#print(f)
|
| 212 |
df = pd.read_csv(f)
|
| 213 |
input_ids = []
|
| 214 |
labels = []
|
|
|
|
| 237 |
input_ids.append(input_id)
|
| 238 |
labels.append('O')
|
| 239 |
elif len(tokenized_input['input_ids']) == 1:
|
| 240 |
+
input_ids.append(tokenized_input['input_ids'][0])
|
| 241 |
if row['tag'] == 'O':
|
| 242 |
labels.append(row['tag'])
|
| 243 |
else:
|
|
|
|
| 245 |
else:
|
| 246 |
continue
|
| 247 |
|
| 248 |
+
#print('got all')
|
| 249 |
for chunk_id, index in enumerate(range(0, len(input_ids), self.CHUNK_SIZE)):
|
| 250 |
split_ids = input_ids[index:max(len(input_ids), index + self.CHUNK_SIZE)]
|
| 251 |
#split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
|
| 252 |
# split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
|
| 253 |
# split_fonts = fonts[index:index + self.CHUNK_SIZE]
|
| 254 |
split_labels = labels[index:max(len(input_ids), index + self.CHUNK_SIZE)]
|
| 255 |
+
#print(split_labels, len(split_labels))
|
| 256 |
+
#print(split_ids, len(split_ids))
|
| 257 |
|
| 258 |
|
| 259 |
yield key, {
|