--- language: - en - py license: mit tags: - code-generation - t5 - text2text-generation - python pipeline_tag: text2text-generation widget: - text: "translate English to Python: create a list of numbers from 1 to 10" - text: "translate English to Python: write a function that calculates factorial" --- # NL2Py v2: English-to-Python Neural Code Translator [![GitHub Repository](https://img.shields.io/badge/GitHub-abdullah00ashraf-181717.svg?logo=github)](https://github.com/abdullah00ashraf/abdullah00ashraf) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) > **Parent GitHub Repository**: [https://github.com/abdullah00ashraf/abdullah00ashraf](https://github.com/abdullah00ashraf/abdullah00ashraf) > **Ecosystem Documentation**: [Axiyon / Producttolaunch Catalog](https://github.com/abdullah00ashraf/sentinel-hufp-v7) Part of the **Axiyon Research Ecosystem**. **Author:** Abdullah Ashraf ([@abdullahashraf122](https://huggingface.co/abdullahashraf122)) **GitHub Profile:** [https://github.com/abdullah00ashraf](https://github.com/abdullah00ashraf) ## Model Overview NL2Py v2 is a specialized seq2seq transformer fine-tuned on the `iamthedan/code-instructions-25k-python` dataset with structural prompt prefixes (`translate English to Python: `). It generates syntax-valid Python code snippets directly from natural language specifications. ### Architecture Highlights * **Base Architecture**: T5-small (60M parameters) * **Tokenizer**: SentencePiece with custom prefix masking * **Max Length**: 128 input tokens $\to$ 512 target tokens * **Loss Function**: Cross-Entropy with label smoothing ### Interactive Demo Run the included `app.py` or execute the training pipeline via `NL2Py_v2_Colab_Pipeline.ipynb`.