File size: 352 Bytes
906b628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
''' Usage
sharegpt_generator = sharegpt_generator()
print(next(sharegpt_generator))
print(next(sharegpt_generator))
print(next(sharegpt_generator))
'''
import json

def sharegpt_generator(file = 'sg_90k_part1_html_cleaned_lang.json'):
    content = json.load(open(file, "r"))
    for item in content:
        yield item['conversations'][0]['value']