dk-crazydiv commited on
Commit
3e96f74
1 Parent(s): f9663e4

Adding Huggingface modelhub dataset

Browse files
.gitattributes CHANGED
@@ -14,3 +14,4 @@
14
  *.pb filter=lfs diff=lfs merge=lfs -text
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
 
14
  *.pb filter=lfs diff=lfs merge=lfs -text
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
+ huggingface-modelhub.csv filter=lfs diff=lfs merge=lfs -text
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"default": {"description": "Metadata of the information available on HuggingFace's modelhub\n", "citation": "\n", "homepage": "https://huggingface.co/models", "license": "", "features": {"modelId": {"dtype": "string", "id": null, "_type": "Value"}, "lastModified": {"dtype": "string", "id": null, "_type": "Value"}, "tags": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pipeline_tag": {"dtype": "string", "id": null, "_type": "Value"}, "files": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "publishedBy": {"dtype": "string", "id": null, "_type": "Value"}, "modelCard": {"dtype": "large_string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "hate_speech_offensive", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 21457237, "num_examples": 10354, "dataset_name": "hate_speech_offensive"}}, "download_checksums": {"huggingface-modelhub.csv": {"num_bytes": 21341037, "checksum": "53d63e7c4fab45592c34bf52927e397377be731cfed82568718bcba27523d85c"}}, "download_size": 21341037, "post_processing_size": null, "dataset_size": 21457237, "size_in_bytes": 42798274}}
dummy/1.0.0/dummy_data.zip ADDED
Binary file (568 Bytes). View file
dummy/1.0.0/dummy_data.zip.lock ADDED
File without changes
huggingface-modelhub.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53d63e7c4fab45592c34bf52927e397377be731cfed82568718bcba27523d85c
3
+ size 21341037
huggingface-modelhub.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Metadata of the information available on HuggingFace's modelhub."""
16
+
17
+
18
+ import ast
19
+ import csv
20
+
21
+ import datasets
22
+ # Some readme files on modelhub are large in size
23
+ csv.field_size_limit(100000000)
24
+
25
+ _CITATION = """\
26
+
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ Metadata of the information available on HuggingFace's modelhub
31
+ """
32
+
33
+ _HOMEPAGE = "https://huggingface.co/models"
34
+
35
+ _LICENSE = ""
36
+
37
+ _URL = "huggingface-modelhub.csv"
38
+
39
+
40
+
41
+ class HuggingfaceModelhub(datasets.GeneratorBasedBuilder):
42
+ """Metadata of the information available on HuggingFace's modelhub"""
43
+
44
+ VERSION = datasets.Version("1.0.0")
45
+
46
+ def _info(self):
47
+ return datasets.DatasetInfo(
48
+ description=_DESCRIPTION,
49
+ features=datasets.Features(
50
+ {
51
+ "modelId": datasets.Value("string"),
52
+ "lastModified": datasets.Value("string"),
53
+ "tags": datasets.features.Sequence(datasets.Value("string")),
54
+ "pipeline_tag": datasets.Value("string"),
55
+ "files": datasets.features.Sequence(datasets.Value("string")),
56
+ "publishedBy": datasets.Value("string"),
57
+ "modelCard": datasets.Value("large_string"),
58
+ }
59
+ ),
60
+ homepage=_HOMEPAGE,
61
+ license=_LICENSE,
62
+ citation=_CITATION,
63
+ )
64
+
65
+ def _split_generators(self, dl_manager):
66
+ """Returns SplitGenerators."""
67
+
68
+ data_file = dl_manager.download_and_extract(_URL)
69
+ return [
70
+ datasets.SplitGenerator(
71
+ name=datasets.Split.TRAIN,
72
+ gen_kwargs={
73
+ "filepath": data_file,
74
+ },
75
+ ),
76
+ ]
77
+
78
+ def _generate_examples(self, filepath):
79
+ """Yields examples."""
80
+
81
+ with open(filepath, encoding="utf-8") as f:
82
+ reader = csv.reader(f)
83
+ for id_, row in enumerate(reader):
84
+ if id_ == 0:
85
+ continue
86
+
87
+ yield id_, {
88
+ "modelId": row[0],
89
+ "lastModified": row[1],
90
+ "tags": ast.literal_eval(row[2]),
91
+ "pipeline_tag": row[3],
92
+ "files": ast.literal_eval(row[4]),
93
+ "publishedBy": row[5],
94
+ "modelCard": row[6]
95
+ }