nyuuzyou commited on
Commit
499015c
·
verified ·
1 Parent(s): 4b5848c

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +252 -0
  2. data.parquet +3 -0
README.md ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - machine-generated
4
+ language_creators:
5
+ - found
6
+ language:
7
+ - code
8
+ - zh
9
+ - en
10
+ license: other
11
+ multilinguality:
12
+ - multilingual
13
+ pretty_name: JihuLab Code Dataset
14
+ size_categories:
15
+ - 1M<n<10M
16
+ source_datasets:
17
+ - original
18
+ task_categories:
19
+ - text-generation
20
+ tags:
21
+ - code
22
+ - chinese
23
+ configs:
24
+ - config_name: default
25
+ data_files:
26
+ - split: train
27
+ path: "data.parquet"
28
+ default: true
29
+ dataset_info:
30
+ features:
31
+ - name: code
32
+ dtype: string
33
+ - name: repo_name
34
+ dtype: string
35
+ - name: path
36
+ dtype: string
37
+ - name: language
38
+ dtype: string
39
+ - name: license
40
+ dtype: string
41
+ - name: size
42
+ dtype: int64
43
+ ---
44
+
45
+ # JihuLab Code Dataset
46
+
47
+ ## Dataset Description
48
+
49
+ This dataset was compiled from code repositories hosted on [JihuLab](https://jihulab.com), a GitLab-based code hosting platform operated by JiHu (GitLab's Chinese joint venture). JihuLab serves as the primary GitLab instance for Chinese developers and enterprises, offering localized services and compliance with Chinese regulations. This dataset is particularly valuable for training code models with Chinese language understanding and enterprise-level coding practices.
50
+
51
+ ### Dataset Summary
52
+
53
+ | Statistic | Value |
54
+ |-----------|-------|
55
+ | **Total Files** | 1,853,253 |
56
+ | **Total Repositories** | 11,589 |
57
+ | **Total Size** | 1.5 GB (compressed Parquet) / 12.76 GB (uncompressed) |
58
+ | **Programming Languages** | 304 |
59
+ | **File Format** | Parquet with Zstd compression |
60
+
61
+ ### Key Features
62
+
63
+ - **Chinese developer ecosystem**: Contains code from JihuLab, GitLab's official Chinese distribution, featuring Chinese comments, documentation, and variable names
64
+ - **Diverse language coverage**: Spans 304 programming languages identified by [go-enry](https://github.com/go-enry/go-enry) (based on GitHub Linguist rules)
65
+ - **Rich metadata**: Includes repository name, file path, detected language, license information, and file size
66
+ - **Enterprise and open-source projects**: Includes code from both individual developers and Chinese enterprises using GitLab
67
+ - **Quality filtered**: Extensive filtering to remove vendor code, build artifacts, generated files, and low-quality content
68
+
69
+ ### Languages
70
+
71
+ The dataset includes 304 programming languages. The top 30 languages by file count:
72
+
73
+ | Rank | Language | File Count |
74
+ |------|----------|------------|
75
+ | 1 | Java | 348,517 |
76
+ | 2 | C | 209,924 |
77
+ | 3 | JavaScript | 191,164 |
78
+ | 4 | Python | 172,798 |
79
+ | 5 | C++ | 136,046 |
80
+ | 6 | Go | 80,000 |
81
+ | 7 | TypeScript | 79,067 |
82
+ | 8 | HTML | 69,173 |
83
+ | 9 | C# | 64,511 |
84
+ | 10 | Rust | 50,515 |
85
+ | 11 | Shell | 43,352 |
86
+ | 12 | Vue | 40,687 |
87
+ | 13 | TSX | 36,844 |
88
+ | 14 | CSS | 34,779 |
89
+ | 15 | Makefile | 26,227 |
90
+ | 16 | Ruby | 25,812 |
91
+ | 17 | PHP | 21,401 |
92
+ | 18 | CMake | 15,292 |
93
+ | 19 | Kotlin | 14,220 |
94
+ | 20 | BitBake | 13,060 |
95
+ | 21 | SCSS | 10,957 |
96
+ | 22 | Scala | 9,333 |
97
+ | 23 | Dart | 9,125 |
98
+ | 24 | Lua | 7,413 |
99
+ | 25 | ASP.NET | 7,005 |
100
+ | 26 | Vim Script | 5,710 |
101
+ | 27 | Unix Assembly | 5,239 |
102
+ | 28 | Starlark | 5,134 |
103
+ | 29 | Objective-C | 4,931 |
104
+ | 30 | Factor | 4,920 |
105
+
106
+ ### Licenses
107
+
108
+ The dataset includes files from repositories with various licenses. Repositories with restrictive licenses (CC-BY-ND variants, Commons Clause, SSPL) were excluded:
109
+
110
+ | License | File Count |
111
+ |---------|------------|
112
+ | apache-2.0 | 551,008 |
113
+ | unknown | 535,320 |
114
+ | mit | 320,834 |
115
+ | agpl-3.0 | 169,922 |
116
+ | gpl-2.0 | 112,829 |
117
+ | bsd | 65,104 |
118
+ | cc0-1.0 | 13,557 |
119
+ | lgpl-3.0 | 12,871 |
120
+ | lgpl-2.1 | 9,960 |
121
+ | bsd-3-clause | 9,109 |
122
+ | bsl-1.1 | 8,972 |
123
+ | epl-1.0 | 7,494 |
124
+ | gpl-3.0 | 7,476 |
125
+ | unlicense | 6,265 |
126
+ | cc-by-3.0 | 4,717 |
127
+ | cc-by-nc-sa | 4,339 |
128
+ | mpl-2.0 | 3,847 |
129
+ | cc-by-4.0 | 2,459 |
130
+ | cc-by-nc-sa-4.0 | 1,715 |
131
+ | cc-by-sa-4.0 | 1,701 |
132
+ | bsd-2-clause | 1,599 |
133
+ | cc-by-nc-nd-4.0 | 1,222 |
134
+ | isc | 520 |
135
+ | wtfpl | 274 |
136
+ | cc-by-nc-4.0 | 122 |
137
+ | cc-by-sa | 13 |
138
+ | cc-by-sa-3.0 | 4 |
139
+
140
+ ## Dataset Structure
141
+
142
+ ### Data Fields
143
+
144
+ | Field | Type | Description |
145
+ |-------|------|-------------|
146
+ | `code` | string | Content of the source file (UTF-8 encoded) |
147
+ | `repo_name` | string | Name of the JihuLab repository (format: `username/repo` or `group/subgroup/repo`) |
148
+ | `path` | string | Path of the file within the repository (relative to repo root) |
149
+ | `language` | string | Programming language as identified by [go-enry](https://github.com/go-enry/go-enry) |
150
+ | `license` | string | License of the repository (SPDX identifier or "unknown") |
151
+ | `size` | int64 | Size of the source file in bytes |
152
+
153
+ ### Data Format
154
+
155
+ - **Format**: Apache Parquet with Zstd compression
156
+ - **File Structure**: Single consolidated file (`data.parquet`)
157
+
158
+ ### Data Splits
159
+
160
+ All examples are in the train split. There is no validation or test split.
161
+
162
+ ### Example Data Point
163
+
164
+ ```
165
+ {
166
+ 'code': 'package com.example.demo;\n\nimport org.springframework.boot.*;\nimport org.springframework.boot.autoconfigure.*;\n...',
167
+ 'repo_name': 'SmallQ/demo',
168
+ 'path': 'src/main/java/com/example/demo/DemoApplication.java',
169
+ 'language': 'Java',
170
+ 'license': 'unknown',
171
+ 'size': 400
172
+ }
173
+ ```
174
+
175
+ ## Dataset Creation
176
+
177
+ ### Pipeline Overview
178
+
179
+ The dataset was created through a multi-stage pipeline:
180
+
181
+ 1. **Repository Discovery**: Paginated API requests to JihuLab's GitLab API (`/api/v4/projects`) to enumerate public repositories
182
+ 2. **Branch Selection**: Using the repository's default branch (typically `main` or `master`)
183
+ 3. **Repository Downloading**: Downloading repository archives via JihuLab's archive endpoint
184
+ 4. **Content Extraction**: Extracting and filtering source code files
185
+ 5. **Parquet Generation**: Writing filtered records to Parquet with Zstd compression
186
+
187
+ ### Language Detection
188
+
189
+ Programming languages are detected using [go-enry](https://github.com/go-enry/go-enry), a Go port of GitHub's Linguist library. Only files classified as **Programming** or **Markup** language types are included (Data and Prose types are excluded).
190
+
191
+ ### License Detection
192
+
193
+ Licenses are detected by:
194
+ 1. Scanning for license files (`LICENSE`, `LICENSE.txt`, `LICENSE.md`, `COPYING`, etc.)
195
+ 2. Matching license text against known patterns (MIT, Apache 2.0, GPL variants, BSD, Creative Commons, etc.)
196
+ 3. Defaulting to "unknown" if no license can be detected
197
+
198
+ **Blocked Licenses**: The following restrictive licenses are excluded from the dataset:
199
+ - `cc-by-nd`, `cc-by-nd-2.0`, `cc-by-nd-3.0`, `cc-by-nd-4.0` (Creative Commons No-Derivatives)
200
+ - `commons-clause`
201
+ - `sspl`, `sspl-1.0` (Server Side Public License)
202
+
203
+ ### File Filtering
204
+
205
+ Extensive filtering is applied to ensure data quality:
206
+
207
+ #### Size Limits
208
+ | Limit | Value |
209
+ |-------|-------|
210
+ | Max repository ZIP size | 48 MB |
211
+ | Max single file size | 1 MB |
212
+ | Max line length | 1,000 characters |
213
+
214
+ #### Excluded Directories
215
+ - **Configuration**: `.git/`, `.github/`, `.gitlab/`, `.vscode/`, `.idea/`, `.vs/`, `.settings/`, `.eclipse/`, `.project/`, `.metadata/`
216
+ - **Vendor/Dependencies**: `node_modules/`, `bower_components/`, `jspm_packages/`, `vendor/`, `third_party/`, `3rdparty/`, `external/`, `packages/`, `deps/`, `lib/vendor/`, `target/dependency/`, `Pods/`
217
+ - **Build Output**: `build/`, `dist/`, `out/`, `bin/`, `target/`, `release/`, `debug/`, `.next/`, `.nuxt/`, `_site/`, `_build/`, `__pycache__/`, `.pytest_cache/`, `cmake-build-*`, `.gradle/`, `.maven/`
218
+
219
+ #### Excluded Files
220
+ - **Lock Files**: `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `Gemfile.lock`, `Cargo.lock`, `poetry.lock`, `Pipfile.lock`, `composer.lock`, `go.sum`, `mix.lock`
221
+ - **Minified Files**: Any file containing `.min.` in the name
222
+ - **Binary Files**: `.exe`, `.dll`, `.so`, `.dylib`, `.a`, `.lib`, `.o`, `.obj`, `.jar`, `.war`, `.ear`, `.class`, `.pyc`, `.pyo`, `.wasm`, `.bin`, `.dat`, `.pdf`, `.doc`, `.docx`, `.xls`, `.xlsx`, `.ppt`, `.pptx`, `.zip`, `.tar`, `.gz`, `.bz2`, `.7z`, `.rar`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.bmp`, `.ico`, `.svg`, `.mp3`, `.mp4`, `.avi`, `.mov`, `.wav`, `.flac`, `.ttf`, `.otf`, `.woff`, `.woff2`, `.eot`
223
+ - **System Files**: `.DS_Store`, `thumbs.db`
224
+
225
+ #### Content Filtering
226
+ - **UTF-8 Validation**: Files must be valid UTF-8 encoded text
227
+ - **Binary Detection**: Files detected as binary by go-enry are excluded
228
+ - **Generated Files**: Files with generation markers in the first 500 bytes are excluded:
229
+ - `generated by`, `do not edit`, `auto-generated`, `autogenerated`, `automatically generated`, `code generator`, `generated code`, `this file is generated`, `@generated`, `<auto-generated`
230
+ - **Empty Files**: Files that are empty or contain only whitespace are excluded
231
+ - **Long Lines**: Files with any line exceeding 1,000 characters are excluded
232
+ - **go-enry Filters**: Additional filtering using go-enry's `IsVendor()`, `IsImage()`, `IsDotFile()`, `IsTest()`, and `IsGenerated()` functions
233
+ - **Documentation-only Repos**: Repositories containing only documentation files (no actual code) are skipped
234
+
235
+ ### Source Data
236
+
237
+ All data originates from public repositories hosted on [JihuLab](https://jihulab.com).
238
+
239
+ ## Considerations for Using the Data
240
+
241
+ ### Personal and Sensitive Information
242
+
243
+ The dataset may contain:
244
+ - Email addresses in code comments or configuration files
245
+ - API keys or credentials that were accidentally committed
246
+ - Personal information in comments or documentation
247
+
248
+ Users should exercise caution and implement appropriate filtering when using this data.
249
+
250
+ ### Licensing Information
251
+
252
+ This dataset is a collection of source code from repositories with various licenses. Any use of all or part of the code gathered in this dataset must abide by the terms of the original licenses, including attribution clauses when relevant. The license field in each data point indicates the license of the source repository.
data.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0384b58386995015b39ace1b225b5b8e39ff8e3389a3b0e7f3ea76a49adabe2
3
+ size 1506293646