Files changed (1) hide show
  1. dataset_creation.py +0 -30
dataset_creation.py DELETED
@@ -1,30 +0,0 @@
1
- from datasets import load_dataset, Dataset
2
- import pandas as pd
3
-
4
- list_languages = ['ada', 'agda', 'alloy', 'antlr', 'applescript', 'assembly', 'augeas', 'awk', 'batchfile', 'bison',
5
- 'bluespec', 'c', 'c++', 'c-sharp', 'clojure', 'cmake', 'coffeescript', 'common-lisp', 'css', 'cuda', 'dart', 'dockerfile', 'elixir',
6
- 'elm', 'emacs-lisp','erlang', 'f-sharp', 'fortran', 'glsl', 'go', 'groovy', 'haskell','html', 'idris', 'isabelle', 'java',
7
- 'java-server-pages', 'javascript', 'julia', 'kotlin', 'lean', 'literate-agda', 'literate-coffeescript', 'literate-haskell',
8
- 'lua', 'makefile', 'maple', 'markdown', 'mathematica', 'matlab', 'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog',
9
- 'protocol-buffer', 'python', 'r', 'racket', 'restructuredtext', 'rmarkdown', 'ruby', 'rust', 'sas', 'scala', 'scheme',
10
- 'shell', 'smalltalk', 'solidity', 'sparql', 'sql', 'stan', 'standard-ml', 'stata', 'systemverilog', 'tcl', 'tcsh', 'tex',
11
- 'thrift', 'typescript', 'verilog', 'vhdl', 'visual-basic', 'xslt', 'yacc', 'zig']
12
-
13
- seed = 0
14
- size = 10_000
15
-
16
- for language in list_languages:
17
- thestack = load_dataset('bigcode/the-stack', use_auth_token=True, split="train", streaming=True, data_dir=f"data/{language}")
18
- print(f"subset {language} loaded")
19
-
20
- ds = thestack.shuffle(seed=seed)
21
- # 10k subset of random samples from ds
22
- small_ds = list(ds.take(size))
23
- # convert to Datasets
24
- small_ds = Dataset.from_pandas(pd.DataFrame(data=small_ds))
25
- print(f"Dataset of {size} samples of {language} creaded")
26
- print(f"Some tests: example 10 {small_ds[10]['lang']}")
27
-
28
- path = f"./data/{language}/data.json"
29
- small_ds.to_json(path)
30
- print(f"Small subset of {language} saved")