初始化项目,由ModelHub XC社区提供模型
Model: Thomas465xd/TinyLlama-1.1B-Chat-v1.0-heretic Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*.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
|
||||||
97
README.md
Normal file
97
README.md
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
datasets:
|
||||||
|
- cerebras/SlimPajama-627B
|
||||||
|
- bigcode/starcoderdata
|
||||||
|
- HuggingFaceH4/ultrachat_200k
|
||||||
|
- HuggingFaceH4/ultrafeedback_binarized
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
widget:
|
||||||
|
- example_title: Fibonacci (Python)
|
||||||
|
messages:
|
||||||
|
- role: system
|
||||||
|
content: You are a chatbot who can help code!
|
||||||
|
- role: user
|
||||||
|
content: Write me a function to calculate the first 10 digits of the fibonacci
|
||||||
|
sequence in Python and print it out to the CLI.
|
||||||
|
tags:
|
||||||
|
- heretic
|
||||||
|
- uncensored
|
||||||
|
- decensored
|
||||||
|
- abliterated
|
||||||
|
---
|
||||||
|
# This is a decensored version of [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0), made using [Heretic](https://github.com/p-e-w/heretic) v1.2.0
|
||||||
|
|
||||||
|
## Abliteration parameters
|
||||||
|
|
||||||
|
| Parameter | Value |
|
||||||
|
| :-------- | :---: |
|
||||||
|
| **direction_index** | per layer |
|
||||||
|
| **attn.o_proj.max_weight** | 0.87 |
|
||||||
|
| **attn.o_proj.max_weight_position** | 20.49 |
|
||||||
|
| **attn.o_proj.min_weight** | 0.04 |
|
||||||
|
| **attn.o_proj.min_weight_distance** | 5.71 |
|
||||||
|
| **mlp.down_proj.max_weight** | 0.89 |
|
||||||
|
| **mlp.down_proj.max_weight_position** | 13.52 |
|
||||||
|
| **mlp.down_proj.min_weight** | 0.65 |
|
||||||
|
| **mlp.down_proj.min_weight_distance** | 1.78 |
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
| Metric | This model | Original model ([TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)) |
|
||||||
|
| :----- | :--------: | :---------------------------: |
|
||||||
|
| **KL divergence** | 0.0269 | 0 *(by definition)* |
|
||||||
|
| **Refusals** | 4/100 | 7/100 |
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
# TinyLlama-1.1B
|
||||||
|
</div>
|
||||||
|
|
||||||
|
https://github.com/jzhang38/TinyLlama
|
||||||
|
|
||||||
|
The TinyLlama project aims to **pretrain** a **1.1B Llama model on 3 trillion tokens**. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.
|
||||||
|
|
||||||
|
|
||||||
|
We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.
|
||||||
|
|
||||||
|
#### This Model
|
||||||
|
This is the chat model finetuned on top of [TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T](https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T). **We follow [HF's Zephyr](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)'s training recipe.** The model was " initially fine-tuned on a variant of the [`UltraChat`](https://huggingface.co/datasets/stingning/ultrachat) dataset, which contains a diverse range of synthetic dialogues generated by ChatGPT.
|
||||||
|
We then further aligned the model with [🤗 TRL's](https://github.com/huggingface/trl) `DPOTrainer` on the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) dataset, which contain 64k prompts and model completions that are ranked by GPT-4."
|
||||||
|
|
||||||
|
|
||||||
|
#### How to use
|
||||||
|
You will need the transformers>=4.34
|
||||||
|
Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Install transformers from source - only needed for versions <= v4.34
|
||||||
|
# pip install git+https://github.com/huggingface/transformers.git
|
||||||
|
# pip install accelerate
|
||||||
|
|
||||||
|
import torch
|
||||||
|
from transformers import pipeline
|
||||||
|
|
||||||
|
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", torch_dtype=torch.bfloat16, device_map="auto")
|
||||||
|
|
||||||
|
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "system",
|
||||||
|
"content": "You are a friendly chatbot who always responds in the style of a pirate",
|
||||||
|
},
|
||||||
|
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
||||||
|
]
|
||||||
|
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||||
|
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
||||||
|
print(outputs[0]["generated_text"])
|
||||||
|
# <|system|>
|
||||||
|
# You are a friendly chatbot who always responds in the style of a pirate.</s>
|
||||||
|
# <|user|>
|
||||||
|
# How many helicopters can a human eat in one sitting?</s>
|
||||||
|
# <|assistant|>
|
||||||
|
# ...
|
||||||
|
```
|
||||||
15
chat_template.jinja
Normal file
15
chat_template.jinja
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{% for message in messages %}
|
||||||
|
{% if message['role'] == 'user' %}
|
||||||
|
{{ '<|user|>
|
||||||
|
' + message['content'] + eos_token }}
|
||||||
|
{% elif message['role'] == 'system' %}
|
||||||
|
{{ '<|system|>
|
||||||
|
' + message['content'] + eos_token }}
|
||||||
|
{% elif message['role'] == 'assistant' %}
|
||||||
|
{{ '<|assistant|>
|
||||||
|
' + message['content'] + eos_token }}
|
||||||
|
{% endif %}
|
||||||
|
{% if loop.last and add_generation_prompt %}
|
||||||
|
{{ '<|assistant|>' }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
29
config.json
Normal file
29
config.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"head_dim": 64,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 2048,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 5632,
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_hidden_layers": 22,
|
||||||
|
"num_key_value_heads": 4,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "4.57.6",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 32000
|
||||||
|
}
|
||||||
7
generation_config.json
Normal file
7
generation_config.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"max_length": 2048,
|
||||||
|
"pad_token_id": 0,
|
||||||
|
"transformers_version": "4.57.6"
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:dd7b24f79b12e708c388a24678ee9a264680c771f6c79395be1ffba18f042d5e
|
||||||
|
size 2200119864
|
||||||
30
special_tokens_map.json
Normal file
30
special_tokens_map.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
277146
tokenizer.json
Normal file
277146
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
43
tokenizer_config.json
Normal file
43
tokenizer_config.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"add_bos_token": true,
|
||||||
|
"add_eos_token": false,
|
||||||
|
"add_prefix_space": null,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"0": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bos_token": "<s>",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "</s>",
|
||||||
|
"extra_special_tokens": {},
|
||||||
|
"legacy": false,
|
||||||
|
"model_max_length": 2048,
|
||||||
|
"pad_token": "</s>",
|
||||||
|
"padding_side": "left",
|
||||||
|
"sp_model_kwargs": {},
|
||||||
|
"tokenizer_class": "LlamaTokenizer",
|
||||||
|
"unk_token": "<unk>",
|
||||||
|
"use_default_system_prompt": false
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user