File size: 4,181 Bytes
2a7eab0
08d90b7
 
 
64b9e9e
08d90b7
 
 
2a7eab0
 
08d90b7
2a7eab0
08d90b7
2a7eab0
 
 
 
 
08d90b7
 
 
 
 
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
 
 
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
08d90b7
 
2a7eab0
08d90b7
 
 
 
2a7eab0
08d90b7
2a7eab0
08d90b7
 
 
 
 
 
 
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
 
 
08d90b7
 
 
 
 
 
2a7eab0
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
 
 
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
2a7eab0
08d90b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
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

- **Repository:** https://huggingface.co/Maelstrome/mermaid-gemmma-7b

## 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:

```python
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:

```python
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.