| | --- |
| | library_name: transformers |
| | tags: [] |
| | --- |
| | |
| | # Model Card for Model ID |
| |
|
| | <!-- Provide a quick summary of what the model is/does. --> |
| |
|
| |
|
| |
|
| | ## Model Details |
| |
|
| | ### Model Description |
| |
|
| | <!-- Provide a longer summary of what this model is. --> |
| |
|
| | 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:** Jaehun Lee, Gunha Hong |
| | - **Model type:** Fine-tuned Gemma2-2b-it variant |
| | - **Language(s) (NLP):** Primarily English, used in coding tasks |
| | - **License:** [More Information Needed] |
| | - **Finetuned from model:** Gemma2-2b-it |
| |
|
| |
|
| | ## Uses |
| |
|
| | <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. --> |
| |
|
| | ### Direct Use |
| |
|
| | <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. --> |
| | Gemma-2-2b-it is fine-tuned for the following direct uses: |
| |
|
| | Code Generation: Automatically generating code from natural language instructions. |
| | Code Evaluation: Evaluating the logic and correctness of code snippets. |
| | Debugging: Identifying bugs and suggesting fixes in code. |
| | Optimization: Proposing improvements to enhance code performance. |
| |
|
| |
|
| | <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app --> |
| |
|
| |
|
| | ### Out-of-Scope Use |
| |
|
| | <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. --> |
| | This model is not intended for general NLP tasks outside the coding domain or tasks requiring extensive world knowledge beyond programming. |
| |
|
| | ## Bias, Risks, and Limitations |
| |
|
| | <!-- This section is meant to convey both technical and sociotechnical limitations. --> |
| | As this model has been fine-tuned specifically for coding, it may underperform in non-programming contexts. The model could generate erroneous code, or incorrect solutions, especially in edge cases or languages less represented in the dataset. It might also produce biased or outdated recommendations for coding practices. |
| |
|
| |
|
| | ### Recommendations |
| |
|
| | <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. --> |
| | Users should be aware of the model’s limitations, especially when using it in production environments. Manual review of the generated code is strongly recommended to avoid potential errors. |
| | 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 Model |
| |
|
| | Use the code below to get started with the model. |
| | ``` |
| | # Use a pipeline as a high-level helper |
| | from transformers import pipeline |
| | |
| | pipe = pipeline("text-generation", model="Molohazi/gemma-2-2b-it-coding") |
| | ``` |
| | ``` |
| | # Load model directly |
| | from transformers import AutoTokenizer, AutoModelForCausalLM |
| | |
| | tokenizer = AutoTokenizer.from_pretrained("Molohazi/gemma-2-2b-it-coding") |
| | model = AutoModelForCausalLM.from_pretrained("Molohazi/gemma-2-2b-it-coding") |
| | ``` |
| |
|
| |
|
| | ## Training Details |
| |
|
| | ### Training Data |
| |
|
| | <!-- 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. --> |
| | Gemma-2-2b-it was fine-tuned using the llama-duo/gemma2b-coding-eval-by-claude3sonnet dataset, which contains a variety of coding tasks, code evaluations, and solutions. This dataset includes examples from a range of programming languages and coding styles. |
| |
|
| | ### 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 |
| | The data was preprocessed to standardize the format of code snippets and ensure compatibility with the model architecture. |
| |
|
| | ### Training Hyperparameters |
| | - Learning rate: 2e-4 |
| | - Optimizer: AdamW |
| | - Max_steps: 300 |
| | - Max_seq_length: 512 |
| | ## Test the Model |
| | ### Python Coding Questions |
| | User input: |
| | "How do I write a function in Python?" |
| | Model output |
| | ``` |
| | In Python, a function is defined using the `def` keyword followed by the function name, parentheses, and a colon. Inside the function, you can write code that gets executed when the function is called. Here's a simple example: |
| | def greet(name): |
| | return f"Hello, {name}!" |
| | # Example usage: |
| | print(greet("Alice")) # Output: Hello, Alice! |
| | ``` |