Update README.md
This commit is contained in:
108
README.md
108
README.md
@@ -1,47 +1,73 @@
|
||||
---
|
||||
license: Apache License 2.0
|
||||
|
||||
#model-type:
|
||||
##如 gpt、phi、llama、chatglm、baichuan 等
|
||||
#- gpt
|
||||
|
||||
#domain:
|
||||
##如 nlp、cv、audio、multi-modal
|
||||
#- nlp
|
||||
|
||||
#language:
|
||||
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
|
||||
#- cn
|
||||
|
||||
#metrics:
|
||||
##如 CIDEr、Blue、ROUGE 等
|
||||
#- CIDEr
|
||||
|
||||
#tags:
|
||||
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
|
||||
#- pretrained
|
||||
|
||||
#tools:
|
||||
##如 vllm、fastchat、llamacpp、AdaSeq 等
|
||||
#- vllm
|
||||
license: gemma
|
||||
base_model: HuggingFaceH4/zephyr-7b-gemma-sft-v0.1
|
||||
tags:
|
||||
- alignment-handbook
|
||||
- generated_from_trainer
|
||||
datasets:
|
||||
- argilla/dpo-mix-7k
|
||||
model-index:
|
||||
- name: DiscoPOP-zephyr-7b-gemma
|
||||
results: []
|
||||
---
|
||||
### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。
|
||||
#### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型
|
||||
|
||||
SDK下载
|
||||
```bash
|
||||
#安装ModelScope
|
||||
pip install modelscope
|
||||
# DiscoPOP-zephyr-7b-gemma
|
||||
|
||||
This model is a fine-tuned version of [HuggingFaceH4/zephyr-7b-gemma-sft-v0.1](https://huggingface.co/HuggingFaceH4/zephyr-7b-gemma-sft-v0.1) on the argilla/dpo-mix-7k dataset.
|
||||
|
||||
This model is from the paper ["Discovering Preference Optimization Algorithms with and for Large Language Models"](https://arxiv.org/abs/2406.08414)
|
||||
|
||||
Read the [blog post on it here!](https://sakana.ai/llm-squared)
|
||||
|
||||
See the codebase to generate it here: [https://github.com/SakanaAI/DiscoPOP](https://github.com/SakanaAI/DiscoPOP)
|
||||
|
||||
## Model description
|
||||
|
||||
This model is identical in training to [HuggingFaceH4/zephyr-7b-gemma-v0.1](https://huggingface.co/HuggingFaceH4/zephyr-7b-gemma-v0.1), except instead of using Direct Preference Optimization (DPO), it uses DiscoPOP.
|
||||
|
||||
DiscoPOP is our Discovered Preference Optimization algorithm, which is defined as follows:
|
||||
|
||||
```
|
||||
```python
|
||||
#SDK模型下载
|
||||
from modelscope import snapshot_download
|
||||
model_dir = snapshot_download('SakanaAI/DiscoPOP-zephyr-7b-gemma')
|
||||
```
|
||||
Git下载
|
||||
```
|
||||
#Git模型下载
|
||||
git clone https://www.modelscope.cn/SakanaAI/DiscoPOP-zephyr-7b-gemma.git
|
||||
def log_ratio_modulated_loss(
|
||||
self,
|
||||
policy_chosen_logps: torch.FloatTensor,
|
||||
policy_rejected_logps: torch.FloatTensor,
|
||||
reference_chosen_logps: torch.FloatTensor,
|
||||
reference_rejected_logps: torch.FloatTensor,
|
||||
) -> torch.FloatTensor:
|
||||
pi_logratios = policy_chosen_logps - policy_rejected_logps
|
||||
ref_logratios = reference_chosen_logps - reference_rejected_logps
|
||||
logits = pi_logratios - ref_logratios
|
||||
# Modulate the mixing coefficient based on the log ratio magnitudes
|
||||
log_ratio_modulation = torch.sigmoid(logits)
|
||||
logistic_component = -F.logsigmoid(self.beta * logits)
|
||||
exp_component = torch.exp(-self.beta * logits)
|
||||
# Blend between logistic and exponential component based on log ratio modulation
|
||||
losses = logistic_component * (1 - log_ratio_modulation) + exp_component * log_ratio_modulation
|
||||
return losses
|
||||
```
|
||||
|
||||
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>
|
||||
|
||||
### Training hyperparameters
|
||||
|
||||
The following hyperparameters were used during training:
|
||||
- learning_rate: 5e-07
|
||||
- train_batch_size: 2
|
||||
- eval_batch_size: 4
|
||||
- seed: 42
|
||||
- distributed_type: multi-GPU
|
||||
- num_devices: 8
|
||||
- gradient_accumulation_steps: 8
|
||||
- total_train_batch_size: 128
|
||||
- total_eval_batch_size: 32
|
||||
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
||||
- lr_scheduler_type: cosine
|
||||
- lr_scheduler_warmup_ratio: 0.1
|
||||
- num_epochs: 2
|
||||
|
||||
### Framework versions
|
||||
|
||||
- Transformers 4.40.1
|
||||
- Pytorch 2.1.2+cu121
|
||||
- Datasets 2.19.0
|
||||
- Tokenizers 0.19.1
|
||||
|
||||
Reference in New Issue
Block a user