Inserloft commited on
Commit
83411a6
·
verified ·
1 Parent(s): 8ce887e

Delete ReadMe.md

Browse files
Files changed (1) hide show
  1. ReadMe.md +0 -164
ReadMe.md DELETED
@@ -1,164 +0,0 @@
1
- ---
2
- license: mit
3
- language:
4
- - en
5
- - es
6
- task_categories:
7
- - text-generation
8
- - fill-mask
9
- - code-generation
10
- size_categories:
11
- - 10K<n<100K
12
- pretty_name: PyMini
13
- tags:
14
- - python
15
- - code
16
- - education
17
- - small-models
18
- - fine-tuning
19
- - synthetic
20
- ---
21
-
22
- # PyMini – A Compact Python Instruction Dataset for Small Language Models
23
-
24
- **PyMini** is a synthetic instruction dataset built by [Inserloft](https://inserloft.com) to teach Python programming to small language models (<2B parameters). It covers fundamental Python concepts through a diverse set of tasks — code prediction, bug fixing, function completion, explanation, and conceptual Q&A. Available in **English, Spanish, or bilingual** versions.
25
-
26
- ## Dataset Description
27
-
28
- PyMini provides a **high-quality, compact, and fully synthetic** dataset for fine-tuning models that need a solid grasp of Python without unnecessary complexity. Every example is generated programmatically, avoiding license issues and giving exact control over difficulty and coverage.
29
-
30
- - **Languages:** English (`en`), Spanish (`es`), or mixed (`both`)
31
- - **Number of examples:** Configurable; default release contains **50,000 examples** (balanced across task types)
32
- - **Format:** JSON Lines (`.jsonl`), easily convertible to Parquet
33
- - **Generated with:** Python script (no web scraping, no copyrighted code)
34
-
35
- ## Dataset Structure
36
-
37
- Each example is a JSON object with three fields:
38
-
39
- ```json
40
- {
41
- "instruction": "string (the task description)",
42
- "input": "string (code snippet or empty)",
43
- "output": "string (the expected answer/code/explanation)"
44
- }
45
- ```
46
-
47
- Example (English):
48
-
49
- ```json
50
- {
51
- "instruction": "What is the output of the following code?",
52
- "input": "```python\nprint(3 + 4 * 5)\n```",
53
- "output": "23"
54
- }
55
- ```
56
-
57
- The `input` field may be empty for tasks like "Write a function...".
58
-
59
- ## Task Types and Distribution
60
-
61
- | Task Type | Description | Approx. Weight |
62
- |---|---|---|
63
- | Predict Output | Given a code snippet, predict what it prints or evaluates to. | 25% |
64
- | Fix Bug | Correct syntax or logical errors in provided code. | 15% |
65
- | Fill Missing Line | Complete a partially written function body to fulfill its purpose. | 15% |
66
- | Write Function | Write a whole function from a natural language specification. | 20% |
67
- | Explain Code | Explain in plain language what a piece of code does. | 15% |
68
- | Concept Question | Answer a theoretical question about Python (e.g., "What is a list?"). | 10% |
69
- | Convert Code | Transform a loop into a comprehension or vice versa. | 5% |
70
-
71
- All code examples are self-contained and focus on core Python: variables, types, conditionals, loops, functions, lists, dictionaries, sets, file handling, exceptions, basic OOP, and comprehensions.
72
-
73
- ## Usage
74
-
75
- Load the dataset directly with the Hugging Face `datasets` library:
76
-
77
- ```python
78
- from datasets import load_dataset
79
-
80
- dataset = load_dataset("inserloft/PyMini", split="train")
81
- print(dataset[0])
82
- ```
83
-
84
- ### Loading from a local JSONL file
85
-
86
- ```python
87
- from datasets import load_dataset
88
-
89
- dataset = load_dataset("json", data_files="PyMini.jsonl", split="train")
90
- ```
91
-
92
- ## Data Fields
93
-
94
- - **instruction** (str): Task description in the chosen language.
95
- - **input** (str): Optional code block (formatted with ` ```python ` fences) or empty string.
96
- - **output** (str): Expected response (may contain code blocks, explanations, or short answers).
97
-
98
- ## Data Splits
99
-
100
- The default release includes a single training split. For evaluation, we recommend either:
101
-
102
- - Holding out a random 5–10% of the data, or
103
- - Using a separate, handcrafted test set of real-world Python problems.
104
-
105
- ## Generation Process
106
-
107
- PyMini is entirely synthetic, generated by a Python script that randomly combines templates and safe code evaluation to produce diverse examples. Key aspects of the generation:
108
-
109
- - **Deduplication:** A hash-based deduplication step prevents exact duplicate examples.
110
- - **Reproducibility:** The script uses a fixed random seed (42) for reproducible generation.
111
- - **Safety:** All code snippets are evaluated in a restricted environment (no file system access, limited built-ins).
112
- - **Customization:** Adjust the number of examples, language (`--lang es/en/both`), and task weights by modifying the script.
113
-
114
- The generation script is included in the repository (`generate_pymini.py`).
115
-
116
- ## Intended Use
117
-
118
- This dataset is intended for fine-tuning small language models (under ~2 billion parameters) to improve their Python understanding and code generation abilities. It is particularly suitable for:
119
-
120
- - Code assistants that must explain or fix Python code.
121
- - Educational tools that teach Python basics.
122
- - Lightweight models running in resource-constrained environments (edge, mobile).
123
-
124
- ## Out-of-Scope Use
125
-
126
- PyMini is not designed for:
127
-
128
- - Large-scale production code generation.
129
- - Mastering advanced Python libraries (NumPy, pandas, Django, etc.).
130
- - Security-sensitive code auditing.
131
-
132
- The examples are deliberately simple and may not cover edge cases of real-world software.
133
-
134
- ## Bias, Risks, and Limitations
135
-
136
- - **Synthetic nature:** The dataset was generated from templates, so it may lack the stylistic variance of human-written code.
137
- - **Language coverage:** While bilingual, the vocabulary is limited to common Python terminology. Colloquial expressions or complex natural language instructions may be underrepresented.
138
- - **No malicious code:** The dataset does not include security vulnerabilities or harmful patterns; it is purely educational.
139
- - **Potential overfitting:** Because of the templated generation, models may memorize patterns rather than generalizing to unseen code. Evaluate on diverse, real-world test sets.
140
-
141
- ## License
142
-
143
- This dataset is released under the MIT License. You are free to use, modify, and distribute it for both research and commercial purposes.
144
-
145
- ## Citation
146
-
147
- If you use PyMini in your work, please cite it as:
148
-
149
- ```bibtex
150
- @misc{pymini2025,
151
- title = {PyMini: A Compact Python Instruction Dataset for Small Language Models},
152
- author = {Inserloft},
153
- year = 2025,
154
- howpublished = {\url{https://huggingface.co/datasets/inserloft/PyMini}}
155
- }
156
- ```
157
-
158
- ## Contributing
159
-
160
- Feel free to open issues or pull requests if you have suggestions for new task types, additional languages, or improvements to the generation script.
161
-
162
- ## Contact
163
-
164
- For questions, reach out via the Hugging Face community tab or through [inserloft.com](https://inserloft.com).