mermaid-gemmma-7b / README.md
Maelstrome's picture
Update README.md
64b9e9e verified
metadata
language:
  - en
license: mit
library_name: peft
tags:
  - code
pipeline_tag: text-generation

Model Card for Mermaid.js Code Generation Model

This model is a fine-tuned version of the Google Gemma-7B model, adapted for generating Mermaid.js code from educational prompts. It has been trained using the LoRA (Low-Rank Adaptation) technique to efficiently adapt the pre-trained model to the specific task of generating Mermaid.js diagrams.

Model Details

Model Description

  • Developed by: Maelstrome
  • Model type: Causal Language Model (CLM)
  • Language(s) (NLP): English
  • License: MIT
  • Finetuned from model: google/gemma-7b

Model Sources

Uses

Direct Use

This model can be used directly to generate Mermaid.js code from educational prompts. It takes an input prompt describing a concept or process and generates the corresponding Mermaid.js diagram code.

Out-of-Scope Use

The model should not be used for generating Mermaid.js code for purposes other than educational diagrams. It may not perform well on complex or highly technical diagrams beyond the scope of the training data.

Bias, Risks, and Limitations

The model's performance and generated outputs are limited by the quality and diversity of the training data. It may exhibit biases or limitations inherited from the pre-trained model (Google Gemma-7B) or introduced during fine-tuning.

Recommendations

Users should be aware that the generated Mermaid.js code may not always be perfect and may require manual review and adjustments. The model's outputs should be used as a starting point and should be carefully reviewed for accuracy and appropriateness.

How to Get Started with the Model

To use the model, you can install the required dependencies and load the model using the following code:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Maelstrome/mermaid-gemmma-7b"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

Then, you can generate Mermaid.js code by providing an input prompt:

prompt = "How does a computer execute a program?"
input_ids = tokenizer.encode(prompt, return_tensors="pt")
outputs = model.generate(input_ids, max_length=150, num_return_sequences=1)
generated_code = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_code)

Training Details

Training Data

The model was fine-tuned using a custom dataset consisting of educational prompts and their corresponding Mermaid.js code. The dataset was created by the model developer and is not publicly available.

Training Procedure

The model was fine-tuned using the LoRA technique, which adapts the pre-trained model by adding a small number of trainable parameters. The training was performed using the Hugging Face transformers library and the peft library for LoRA.

Training Hyperparameters

  • Training regime: bf16 mixed precision
  • Batch size: 4
  • Gradient accumulation steps: 4
  • Learning rate: 2e-5
  • Max steps: 200
  • Warmup steps: 20

Evaluation

The model's performance was evaluated using a held-out test set from the training data. The generated Mermaid.js code was compared against the expected code, and the model's ability to generate accurate and coherent diagrams was assessed qualitatively.

Results

The model demonstrated the ability to generate Mermaid.js code that closely matched the expected code for the given educational prompts. However, a thorough quantitative evaluation has not been performed.

Environmental Impact

The model was fine-tuned using an Intel GPU (XPU). The specific carbon emissions and environmental impact details are not available.

More Information

For more information or questions about the model, please contact the model developer, Maelstrome, via their Hugging Face profile: https://huggingface.co/Maelstrome

Model Card Authors

This model card was written by the model developer, Maelstrome, based on the information available in the provided code.