jblitzar commited on
Commit
4aecd25
·
verified ·
1 Parent(s): aea4c62

Upload folder using huggingface_hub

Browse files
A_python_files_elaborated_metadata.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46359841e7cf01ebd2232ff24f310644481798ba85138db310dee8fb29417bbd
3
+ size 22895119
B_github_python_metadata.csv ADDED
The diff for this file is too large to render. See raw diff
 
C_mega_licensed_corpus_redacted.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25872f695fefeb4106ddd7006c798767be925a67abadf5d22da240541cad6717
3
+ size 767255913
README.md CHANGED
@@ -1,41 +1,20 @@
1
  ---
2
  annotations_creators:
3
- - author
4
  license:
5
- - gpl-3.0
6
  multilinguality:
7
- - monolingual
8
  pretty_name: GitHub-Python
9
  dataset_name: github-python
10
  dataset_type: code
11
  tags:
12
- - code
13
- - python
14
  size_categories:
15
- - 100K<n⩽1M
16
  task_categories:
17
- - text-generation
18
- configs:
19
- - config_name: default
20
- data_files:
21
- - split: github_meta_elaborated
22
- path: data/github_meta_elaborated-*
23
- dataset_info:
24
- features:
25
- - name: repo_owner
26
- dtype: string
27
- - name: repo_name
28
- dtype: string
29
- - name: file_path
30
- dtype: string
31
- - name: file_url
32
- dtype: string
33
- splits:
34
- - name: github_meta_elaborated
35
- num_bytes: 24941794
36
- num_examples: 186066
37
- download_size: 8323253
38
- dataset_size: 24941794
39
  ---
40
 
41
  # GitHub-Python — Licensed & Elaborated Variants
 
1
  ---
2
  annotations_creators:
3
+ - author
4
  license:
5
+ - gpl-3.0
6
  multilinguality:
7
+ - monolingual
8
  pretty_name: GitHub-Python
9
  dataset_name: github-python
10
  dataset_type: code
11
  tags:
12
+ - code
13
+ - python
14
  size_categories:
15
+ - 100K<n⩽1M
16
  task_categories:
17
+ - text-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ---
19
 
20
  # GitHub-Python — Licensed & Elaborated Variants
dataset.py CHANGED
@@ -1,41 +1,29 @@
1
- import csv
2
- import datasets
3
 
4
- class ElaboratedMetadataConfig(datasets.BuilderConfig):
5
- def __init__(self, **kwargs):
6
- super().__init__(**kwargs)
7
 
8
- class ElaboratedMetadata(datasets.GeneratorBasedBuilder):
9
- BUILDER_CONFIGS = [
10
- ElaboratedMetadataConfig(name="default", version=datasets.Version("1.0.0"))
11
- ]
 
 
12
 
13
- def _info(self):
14
- return datasets.DatasetInfo(
15
- features=datasets.Features({
16
- "owner": datasets.Value("string"),
17
- "repo_name": datasets.Value("string"),
18
- "file_path": datasets.Value("string"),
19
- "url": datasets.Value("string"),
20
- }),
21
- )
22
 
23
- def _split_generators(self, dl_manager):
24
- data_path = dl_manager.download("A_python_files_elaborated_metadata.csv")
25
- return [
26
- datasets.SplitGenerator(
27
- name=datasets.Split.TRAIN,
28
- gen_kwargs={"filepath": data_path},
29
- )
30
- ]
31
 
32
- def _generate_examples(self, filepath):
33
- with open(filepath, encoding="utf-8") as f:
34
- reader = csv.DictReader(f)
35
- for idx, row in enumerate(reader):
36
- yield idx, {
37
- "owner": row["owner"],
38
- "repo_name": row["repo_name"],
39
- "file_path": row["file_path"],
40
- "url": row["url"],
41
- }
 
 
 
1
+ from datasets import Dataset
2
+ import pandas as pd
3
 
4
+ a_path = "A_python_files_elaborated_metadata.csv"
5
+ b_path = "B_github_python_metadata.csv"
6
+ c_path = "C_mega_licensed_corpus_redacted.txt"
7
 
8
+ df_a = pd.read_csv(a_path)
9
+ df_a = df_a.rename(columns={
10
+ "owner": "repo_owner",
11
+ "url": "file_url"
12
+ })
13
+ ds_a = Dataset.from_pandas(df_a)
14
 
15
+ ds_a.push_to_hub("jblitzar/github-python-meta-elaborated", split="train")
 
 
 
 
 
 
 
 
16
 
 
 
 
 
 
 
 
 
17
 
18
+ df_b = pd.read_csv("B_github_python_metadata.csv")
19
+ df_b["repo_url"] = df_b.get("repo_url", "unknown")
20
+ print("Columns in df_b:", df_b.columns)
21
+ from datasets import Dataset
22
+ ds_b = Dataset.from_pandas(df_b)
23
+ ds_b.push_to_hub("jblitzar/github-python-metadata", split="train")
24
+
25
+
26
+ with open(c_path, encoding="utf-8", errors="ignore") as f:
27
+ lines = f.readlines()
28
+ ds_c = Dataset.from_dict({"text": lines})
29
+ ds_c.push_to_hub("jblitzar/github-python-corpus", split="train")