初始化项目,由ModelHub XC社区提供模型
Model: 0xA50C1A1/Mistral-Nemo-Instruct-2407-Heretic-v2 Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
68
README.md
Normal file
68
README.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
base_model:
|
||||||
|
- unsloth/Mistral-Nemo-Instruct-2407
|
||||||
|
library_name: transformers
|
||||||
|
license: apache-2.0
|
||||||
|
tags:
|
||||||
|
- mistral
|
||||||
|
- unsloth
|
||||||
|
- transformers
|
||||||
|
- heretic
|
||||||
|
- uncensored
|
||||||
|
- decensored
|
||||||
|
- abliterated
|
||||||
|
---
|
||||||
|
# This is a decensored version of [unsloth/Mistral-Nemo-Instruct-2407](https://huggingface.co/unsloth/Mistral-Nemo-Instruct-2407), made using [Heretic](https://github.com/p-e-w/heretic) v1.2.0
|
||||||
|
|
||||||
|
## Abliteration parameters
|
||||||
|
|
||||||
|
| Parameter | Value |
|
||||||
|
| :-------- | :---: |
|
||||||
|
| **direction_index** | 18.46 |
|
||||||
|
| **attn.o_proj.max_weight** | 1.29 |
|
||||||
|
| **attn.o_proj.max_weight_position** | 29.40 |
|
||||||
|
| **attn.o_proj.min_weight** | 1.08 |
|
||||||
|
| **attn.o_proj.min_weight_distance** | 18.39 |
|
||||||
|
| **mlp.down_proj.max_weight** | 1.47 |
|
||||||
|
| **mlp.down_proj.max_weight_position** | 24.17 |
|
||||||
|
| **mlp.down_proj.min_weight** | 1.41 |
|
||||||
|
| **mlp.down_proj.min_weight_distance** | 19.35 |
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
| Metric | This model | Original model ([unsloth/Mistral-Nemo-Instruct-2407](https://huggingface.co/unsloth/Mistral-Nemo-Instruct-2407)) |
|
||||||
|
| :----- | :--------: | :---------------------------: |
|
||||||
|
| **KL divergence** | 0.0574 | 0 *(by definition)* |
|
||||||
|
| **Refusals** | 4/100 | 88/100 |
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
|
||||||
|
# Finetune Mistral, Gemma, Llama 2-5x faster with 70% less memory via Unsloth!
|
||||||
|
|
||||||
|
We have a free Google Colab Tesla T4 notebook for Mistral Nemo 12b here: https://colab.research.google.com/drive/17d3U-CAIwzmbDRqbZ9NnpHxCkmXB6LZ0?usp=sharing
|
||||||
|
|
||||||
|
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/Discord%20button.png" width="200"/>](https://discord.gg/u54VK8m8tk)
|
||||||
|
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/buy%20me%20a%20coffee%20button.png" width="200"/>](https://ko-fi.com/unsloth)
|
||||||
|
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
||||||
|
|
||||||
|
## ✨ Finetune for Free
|
||||||
|
|
||||||
|
All notebooks are **beginner friendly**! Add your dataset, click "Run All", and you'll get a 2x faster finetuned model which can be exported to GGUF, vLLM or uploaded to Hugging Face.
|
||||||
|
|
||||||
|
| Unsloth supports | Free Notebooks | Performance | Memory use |
|
||||||
|
|-----------------|--------------------------------------------------------------------------------------------------------------------------|-------------|----------|
|
||||||
|
| **Llama-3 8b** | [▶️ Start on Colab](https://colab.research.google.com/drive/135ced7oHytdxu3N2DNe1Z0kqjyYIkDXp?usp=sharing) | 2.4x faster | 58% less |
|
||||||
|
| **Gemma 7b** | [▶️ Start on Colab](https://colab.research.google.com/drive/10NbwlsRChbma1v55m8LAPYG15uQv6HLo?usp=sharing) | 2.4x faster | 58% less |
|
||||||
|
| **Mistral 7b** | [▶️ Start on Colab](https://colab.research.google.com/drive/1Dyauq4kTZoLewQ1cApceUQVNcnnNTzg_?usp=sharing) | 2.2x faster | 62% less |
|
||||||
|
| **Llama-2 7b** | [▶️ Start on Colab](https://colab.research.google.com/drive/1lBzz5KeZJKXjvivbYvmGarix9Ao6Wxe5?usp=sharing) | 2.2x faster | 43% less |
|
||||||
|
| **TinyLlama** | [▶️ Start on Colab](https://colab.research.google.com/drive/1AZghoNBQaMDgWJpi4RbffGM1h6raLUj9?usp=sharing) | 3.9x faster | 74% less |
|
||||||
|
| **CodeLlama 34b** A100 | [▶️ Start on Colab](https://colab.research.google.com/drive/1y7A0AxE3y8gdj4AVkl2aZX47Xu3P1wJT?usp=sharing) | 1.9x faster | 27% less |
|
||||||
|
| **Mistral 7b** 1xT4 | [▶️ Start on Kaggle](https://www.kaggle.com/code/danielhanchen/kaggle-mistral-7b-unsloth-notebook) | 5x faster\* | 62% less |
|
||||||
|
| **DPO - Zephyr** | [▶️ Start on Colab](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing) | 1.9x faster | 19% less |
|
||||||
|
|
||||||
|
- This [conversational notebook](https://colab.research.google.com/drive/1Aau3lgPzeZKQ-98h69CCu1UJcvIBLmy2?usp=sharing) is useful for ShareGPT ChatML / Vicuna templates.
|
||||||
|
- This [text completion notebook](https://colab.research.google.com/drive/1ef-tab5bhkvWmBOObepl1WgJvfvSzn5Q?usp=sharing) is for raw text. This [DPO notebook](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing) replicates Zephyr.
|
||||||
|
- \* Kaggle has 2x T4s, but we use 1. Due to overhead, 1x T4 is 5x faster.
|
||||||
95
chat_template.jinja
Normal file
95
chat_template.jinja
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
{%- if messages[0]["role"] == "system" %}
|
||||||
|
{%- set system_message = messages[0]["content"] %}
|
||||||
|
{%- set loop_messages = messages[1:] %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set loop_messages = messages %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if not tools is defined %}
|
||||||
|
{%- set tools = none %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
|
||||||
|
|
||||||
|
{#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
|
||||||
|
{%- set ns = namespace() %}
|
||||||
|
{%- set ns.index = 0 %}
|
||||||
|
{%- for message in loop_messages %}
|
||||||
|
{%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
|
||||||
|
{%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
|
||||||
|
{{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set ns.index = ns.index + 1 %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{{- bos_token }}
|
||||||
|
{%- for message in loop_messages %}
|
||||||
|
{%- if message["role"] == "user" %}
|
||||||
|
{%- if tools is not none and (message == user_messages[-1]) %}
|
||||||
|
{{- "[AVAILABLE_TOOLS][" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{%- set tool = tool.function %}
|
||||||
|
{{- '{"type": "function", "function": {' }}
|
||||||
|
{%- for key, val in tool.items() if key != "return" %}
|
||||||
|
{%- if val is string %}
|
||||||
|
{{- '"' + key + '": "' + val + '"' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '"' + key + '": ' + val|tojson }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if not loop.last %}
|
||||||
|
{{- ", " }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "}}" }}
|
||||||
|
{%- if not loop.last %}
|
||||||
|
{{- ", " }}
|
||||||
|
{%- else %}
|
||||||
|
{{- "]" }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "[/AVAILABLE_TOOLS]" }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if loop.last and system_message is defined %}
|
||||||
|
{{- "[INST]" + system_message + "\n\n" + message["content"] + "[/INST]" }}
|
||||||
|
{%- else %}
|
||||||
|
{{- "[INST]" + message["content"] + "[/INST]" }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- elif (message.tool_calls is defined and message.tool_calls is not none) %}
|
||||||
|
{% generation %}
|
||||||
|
{{- "[TOOL_CALLS][" }}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- set out = tool_call.function|tojson %}
|
||||||
|
{{- out[:-1] }}
|
||||||
|
{%- if not tool_call.id is defined or tool_call.id|length != 9 %}
|
||||||
|
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- ', "id": "' + tool_call.id + '"}' }}
|
||||||
|
{%- if not loop.last %}
|
||||||
|
{{- ", " }}
|
||||||
|
{%- else %}
|
||||||
|
{{- "]" + eos_token }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{% endgeneration %}
|
||||||
|
|
||||||
|
{%- elif message["role"] == "assistant" %}
|
||||||
|
{% generation %}
|
||||||
|
{{- message["content"] + eos_token }}
|
||||||
|
{% endgeneration %}
|
||||||
|
|
||||||
|
{%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
|
||||||
|
{%- if message.content is defined and message.content.content is defined %}
|
||||||
|
{%- set content = message.content.content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set content = message.content %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '[TOOL_RESULTS]{"content": ' + content|string + ", " }}
|
||||||
|
{%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
|
||||||
|
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
|
||||||
|
|
||||||
|
{%- else %}
|
||||||
|
{{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
31
config.json
Normal file
31
config.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"MistralForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 5120,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 14336,
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"model_type": "mistral",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_hidden_layers": 40,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"pad_token_id": 10,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 1000000.0,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "5.3.0",
|
||||||
|
"unsloth_fixed": true,
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 131072
|
||||||
|
}
|
||||||
8
generation_config.json
Normal file
8
generation_config.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"max_length": 131072,
|
||||||
|
"pad_token_id": 10,
|
||||||
|
"transformers_version": "5.3.0"
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:367fbe8ecd01f267811717f26f3a5912311425eeaa173ab25728a273c2e8f883
|
||||||
|
size 24495607560
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8bf3b3d6214dce22c2aa088e17fd3d059bb7069b0b1c8098ace2867d4b96b20a
|
||||||
|
size 17078447
|
||||||
8021
tokenizer_config.json
Normal file
8021
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user