--- library_name: transformers metrics: - bleu : 0.67 - chrf : 0.73 --- # Model Card for Model ID This is the Gemma-2b-IT model fine-tuned for the Python code generation task. ## Model Details ### Model Description This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated. - **Developed by:** Mohammed Ashraf - **Model type:** google/gemma-2b - **Finetuned from model [optional]:** google/gemma-2b-it ## Uses ### Direct Use Use this model to generate Python code. ### Out-of-Scope Use This model is trained on very basic Python code, so it might not be able to handle complex code. ## How to Get Started with the Model Use the code below to get started with the model. ```python # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM model_id = "mrSoul7766/gemma-2b-it-python-code-gen-adapter" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) text = """how to covert json to dataframe. model""" #device = "cuda:0" inputs = tokenizer(text, return_tensors="pt") outputs = model.generate(**inputs, max_new_tokens=200) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Training Details ### Training Data **Fine-tuning Data:** [flytech/python-codes-25k](https://huggingface.co/datasets/flytech/python-codes-25k/viewer/default/train?p=2&row=294) ### Training Procedure #### Training Hyperparameters - **Training regime:** fp16 - **learning_rate:** 2e-4 ## Evaluation ### Testing Data & Metrics #### Testing Data [iamtarun/python_code_instructions_18k_alpaca](https://huggingface.co/datasets/iamtarun/python_code_instructions_18k_alpaca?row=44) #### Metrics - **chrf:** 0.73 - **codebleu:** 0.67 - **codebleu_ngram:** 0.53 ### Results ```python import json import pandas as pd # Load the JSON data with open('data.json', 'r') as f: data = json.load(f) # Create the DataFrame df = pd.DataFrame(data) ``` #### Summary ## Environmental Impact 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:** H100 - **Hours used:** 30 minutes - **Cloud Provider:** Google-cloud ## Technical Specifications [optional] ### Model Architecture and Objective #### Hardware - **Hardware Type:** H100 - **Hours used:** 30 minutes - **Cloud Provider:** Google-cloud #### Software - bitsandbytes==0.42.0 - peft==0.8.2 - trl==0.7.10 - accelerate==0.27.1 - datasets==2.17.0 - transformers==4.38.0