Instructions to use akshaybharadwaj96/nl-code-gen-python with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use akshaybharadwaj96/nl-code-gen-python with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen-350M-mono") model = PeftModel.from_pretrained(base_model, "akshaybharadwaj96/nl-code-gen-python") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files123456712 unmodified lines20212223242526272829303132333411 unmodified lines464748495051525354555657585960616263646566676869707172737475767778798081821 unmodified line848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771 unmodified line179180181182183184185186187188189190191192193194195196197198199200201202203204205206207---base_model: Salesforce/codegen-350M-monolibrary_name: peftlicense: apache-2.0datasets:- google/code_x_glue_ct_code_to_textlanguage:12 unmodified lines### Model Description<!-- Provide a longer summary of what this model is. -->- **Developed by:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]<!-- ### Model Sources [optional]11 unmodified lines<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->[More Information Needed]### Downstream Use [optional]<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->[More Information Needed]### Out-of-Scope Use<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->[More Information Needed]## Bias, Risks, and Limitations<!-- This section is meant to convey both technical and sociotechnical limitations. -->[More Information Needed]### Recommendations<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.## How to Get Started with the ModelUse the code below to get started with the model.[More Information Needed]## Training Details1 unmodified line<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->[More Information Needed]### Training Procedure<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->#### Preprocessing [optional][More Information Needed]#### Training Hyperparameters- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->#### Speeds, Sizes, Times [optional]<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->[More Information Needed]## Evaluation<!-- This section describes the evaluation protocols and provides the results. -->### Testing Data, Factors & Metrics#### Testing Data<!-- This should link to a Dataset Card if possible. -->[More Information Needed]#### Factors<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->[More Information Needed]#### Metrics<!-- These are the evaluation metrics being used, ideally with a description of why. -->[More Information Needed]### Results[More Information Needed]#### Summary## Model Examination [optional]<!-- Relevant interpretability work for the model goes here -->[More Information Needed]## Environmental Impact<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]## Technical Specifications [optional]### Model Architecture and Objective[More Information Needed]### Compute Infrastructure[More Information Needed]#### Hardware[More Information Needed]#### Software[More Information Needed]## Citation [optional]1 unmodified line**BibTeX:**[More Information Needed]**APA:**[More Information Needed]## Glossary [optional]<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->[More Information Needed]## More Information [optional][More Information Needed]## Model Card Authors [optional][More Information Needed]## Model Card Contact[More Information Needed]### Framework versions-->- PEFT 0.7.2.dev0123456712 unmodified lines202122232425262728293031323334353637383911 unmodified lines515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121 unmodified line1141151161171181191201211221231241251261271281291301311321331341351361371381391401 unmodified line142143144145146147148149150151152153---base_model: Salesforce/codegen-350M-monolibrary_name: peftlicense: mitdatasets:- google/code_x_glue_ct_code_to_textlanguage:12 unmodified lines### Model Description<!-- Provide a longer summary of what this model is. -->This model is a fine-tuned variant of Salesforce/codegen-350M-mono,specialized for natural language to code generation in Python.It takes natural language instructions (e.g., “check MySQL database connection”)and generates the corresponding Python code snippet.The model was trained on a curated text-to-code dataset containing diverseprogramming instructions and function-level examples to improve semantic and syntactic accuracy.- **Developed by:** Akshay Bharadwaj- **Model type:** Transformer-based Causal Language Model- **Language(s) (NLP):** English (Prompts) and Python (Code Outputs)- **License:** MIT License- **Finetuned from model [optional]:** Salesforce/codegen-350M-mono<!-- ### Model Sources [optional]11 unmodified lines<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->The model can be used for:* Translating natural language prompts into functional Python code.* Assisting in code autocompletion or boilerplate generation.* Supporting educational and prototyping environments.### Downstream Use<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->Can be integrated into:* Developer tools (IDE plugins or assistants).* Chatbots for code assistance or educational coding tutors.* LLM pipelines for multi-step reasoning or coding workflows.### Out-of-Scope Use<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->* Generating production-level code without human review.* Security-critical or real-time applications (e.g., code execution automation).* Generation of malicious or unsafe code.## Bias, Risks, and Limitations<!-- This section is meant to convey both technical and sociotechnical limitations. -->* The model may produce incomplete or syntactically incorrect code for ambiguous prompts.* It can misinterpret vague natural language queries (semantic drift).* Potential bias toward common Python idioms and limited handling of rare libraries or APIs.## How to Get Started with the ModelUse the code below to get started with the model.```from transformers import AutoTokenizer, AutoModelForCausalLMmodel_id = "akshayb/nl-code-gen-python"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id)prompt = "write a python function to check mysql database connection"inputs = tokenizer(prompt, return_tensors="pt")outputs = model.generate(**inputs, max_new_tokens=256)print(tokenizer.decode(outputs[0], skip_special_tokens=True))```## Training Details1 unmodified line<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->The dataset contains paired natural language descriptionsand Python function implementations, collected and cleanedfrom public code repositories and text-to-code benchmarks (e.g., CodeXGLUE).Preprocessing involved deduplication, tokenization, and removal of incomplete code samples.## Evaluation<!-- This section describes the evaluation protocols and provides the results. -->#### Metrics<!-- These are the evaluation metrics being used, ideally with a description of why. -->For Comparison between Base Model and Fine-tuned model, we use the following metrics:| Metric | Focus | Strength || ---------------- | ------------------------------ | ----------------------------------------- || **BLEU** | Token-level similarity | Measures fluency and lexical accuracy || **CodeBLEU** | Lexical + syntactic + semantic | Captures holistic code quality || **Exact Match** | String equality | Strict correctness measure || **Syntax Match** | AST structure | Validates syntactic and logical integrity |## Citation [optional]1 unmodified line**BibTeX:**@misc{akshay2025nlcodegen,title={Natural Language to Code Generation (Fine-tuned CodeGen-350M)},author={Akshay Bharadwaj},year={2025},howpublished={\url{https://huggingface.co/akshayb/nl-code-gen-python}}}- PEFT 0.7.2.dev0
README.md+63-117