File size: 1,044 Bytes
938a051
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# --------------------------------------------
import keyring as kr 
import os
import random
import json
import re
import sys
import time
from collections import defaultdict
from functools import reduce

import codefast as cf
import joblib
import numpy as np
import pandas as pd
from rich import print
from typing import List, Union, Callable, Set, Dict, Tuple, Optional, Any

from pydantic import BaseModel

import asyncio
import aiohttp
import aioredis
from codefast.patterns.pipeline import Pipeline, BeeMaxin
# —--------------------------------------------
import datasets

ds = datasets.load_dataset('ttxy/takeout_10k')
print(ds)
df = ds['train'].to_pandas()
df.rename(columns={'review':'text'},inplace=True)
df = df.sample(frac=1)
from sklearn.model_selection import train_test_split

X,Xv = train_test_split(df,test_size=0.1,random_state=42)
X,Xt = train_test_split(X,test_size=0.1,random_state=42)
print(X.shape,Xv.shape,Xt.shape)
X.to_csv('train.csv',index=False)
Xv.to_csv('valid.csv',index=False)
Xt.to_csv('test.csv',index=False)