🚀 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