🚀 Laser-Dolphin-Mixtral-4x7b-dpo
Laser-Dolphin-Mixtral-4x7b-dpo 是一个基于特定模型改进的中等规模 MoE 实现模型,可用于文本生成任务,在多个基准测试中表现良好。
🚀 快速开始
该模型基于 cognitivecomputations/dolphin-2.6-mistral-7b-dpo-laser 进行改进,具体流程可参考 此笔记本。
✨ 主要特性
- 基于特定模型改进的中等规模 MoE 实现。
- 在多个文本生成任务的基准测试中取得了不错的成绩。
📦 安装指南
暂未提供安装步骤相关内容。
💻 使用示例
基础用法
from transformers import AutoModelForCausalLM, AutoTokenizer
def generate_response(prompt):
"""
Generate a response from the model based on the input prompt.
Args:
prompt (str): Prompt for the model.
Returns:
str: The generated response from the model.
"""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
model_id = "macadeliccc/laser-dolphin-mixtral-4x7b-dpo"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
prompt = "Write a quicksort algorithm in python"
print("Response:")
print(generate_response(prompt), "\n")
示例输出
当输入问题 can you write me a quicksort algorithm in python?
时,模型输出如下:
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
此实现使用数组的中位数作为基准。它首先检查数组是否只有一个或更少的元素,如果是,则数组已经排序,可以直接返回。否则,它选择数组的中间元素作为基准。然后,它将数组划分为三个子数组:小于基准的元素、等于基准的元素和大于基准的元素。它递归地对左右子数组进行排序,并将结果与中间子数组连接起来,以获得最终的排序数组。
📚 详细文档
量化
支持 4-bit AWQ 量化。
评估
模型以 4bit 进行评估
----Benchmark Complete----
+ 2024-01-24 15:03:08
+ Time taken: 37.4 mins
+ Prompt Format: Mistral
+ Model: macadeliccc/laser-dolphin-mixtral-4x7b-dpo
+ Score (v2): 71.04
+ Parseable: 169.0
---------------
详细结果可查看 此处
属性 |
详情 |
平均得分 |
66.71 |
AI2 Reasoning Challenge (25-Shot) |
64.93 |
HellaSwag (10-Shot) |
85.81 |
MMLU (5-Shot) |
63.04 |
TruthfulQA (0-shot) |
63.77 |
Winogrande (5-shot) |
77.82 |
GSM8k (5-shot) |
44.88 |
🔧 技术细节
暂未提供相关技术细节内容。
📄 许可证
本项目采用 Apache-2.0 许可证。
📖 引用
- Fernando Fernandes Neto 和 Eric Hartford. "Optimizing Large Language Models Using Layer-Selective Rank Reduction and Random Matrix Theory." 2024.
@article{sharma2023truth,
title={The Truth is in There: Improving Reasoning in Language Models with Layer-Selective Rank Reduction},
author={Sharma, Pratyusha and Ash, Jordan T and Misra, Dipendra},
journal={arXiv preprint arXiv:2312.13558},
year={2023} }
@article{gao2021framework,
title={A framework for few-shot language model evaluation},
author={Gao, Leo and Tow, Jonathan and Biderman, Stella and Black, Sid and DiPofi, Anthony and Foster, Charles and Golding, Laurence and Hsu, Jeffrey and McDonell, Kyle and Muennighoff, Niklas and others},
journal={Version v0. 0.1. Sept},
year={2021}
}

感谢 Fernando Fernandes 和 Eric Hartford 的项目 laserRMT