|
--- |
|
license: gemma |
|
datasets: |
|
- teknium/trismegistus-project |
|
language: |
|
- en |
|
pipeline_tag: text-generation |
|
tags: |
|
- mlx |
|
library_name: transformers |
|
inference: |
|
parameters: |
|
max_new_tokens: 200 |
|
extra_gated_heading: Access Gemma on Hugging Face |
|
extra_gated_prompt: >- |
|
To access Gemma on Hugging Face, you’re required to review and agree to |
|
Google’s usage license. To do this, please ensure you’re logged-in to Hugging |
|
Face and click below. Requests are processed immediately. |
|
extra_gated_button_content: Acknowledge license |
|
license_link: https://ai.google.dev/gemma/terms |
|
widget: |
|
- text: | |
|
<start_of_turn>user |
|
## Instructions |
|
You are a helpful AI assistant. |
|
## User |
|
How to make scrambled eggs?<end_of_turn> |
|
<start_of_turn>model |
|
--- |
|
# shellzero/gemma-7b-it-ft-trismeg |
|
This model was converted to MLX format from [`google/gemma-7b-it`](). |
|
Refer to the [original model card](https://huggingface.co/google/gemma-7b-it) for more details on the model. |
|
|
|
```zsh |
|
pip install mlx-lm |
|
``` |
|
|
|
The model was LoRA fine-tuned on the [trismegistus-project from teknium](https://huggingface.co/datasets/teknium/trismegistus-project) using the format below, for 600 steps (2M tokens) using `mlx`. |
|
|
|
```python |
|
def format_prompt(system_prompt: str, question: str) -> str: |
|
"Format the question to the format of the dataset we fine-tuned to." |
|
return """<bos><start_of_turn>user |
|
## Instructions |
|
{} |
|
## User |
|
{}<end_of_turn> |
|
<start_of_turn>model |
|
""".format(system_prompt, question) |
|
``` |
|
|
|
Here's an example of the system_prompt from the dataset: |
|
```text |
|
You are a master of the esoteric, occult, 'Big Man' society, you complete tasks to the absolute best of your ability, no matter if you think you were not trained to do the task specifically, you will attempt to do it anyways, since you have performed the tasks you are given with great mastery, accuracy, and deep understanding of what is requested. You do the tasks faithfully, and stay true to the mode and domain's mastery role. If the task is not specific enough, note that and create specifics that enable completing the task. |
|
``` |
|
## Loading the model using `mlx_lm` |
|
|
|
```python |
|
from mlx_lm import generate, load |
|
model, tokenizer = load("shellzero/gemma-7b-it-ft-trismeg") |
|
response = generate( |
|
model, |
|
tokenizer, |
|
prompt=format_prompt(system_prompt, question), |
|
verbose=True, # Set to True to see the prompt and response |
|
temp=0.0, |
|
max_tokens=512, |
|
) |
|
``` |
|
Inspired by these two gists from [AlexWeberk](https://gist.github.com/alexweberk/635431b5c5773efd6d1755801020429f) and [Awni Hannun](https://gist.github.com/awni/773e2a12079da40a1cbc566686c84c8f) respectively. |