Model Card for Model ID
Model Details
Model Description
Install
pip install peft transformers bitsandbytes
Run by transformers
from transformers import TextStreamer, AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2",)
mis_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", load_in_4bit = True)
mis_model = PeftModel.from_pretrained(mis_model, "svjack/DPO_Bactrian_X_ZH_RJ_EN_ORPO_Mistral7B_v2_inst_lora_small")
mis_model = mis_model.eval()
streamer = TextStreamer(tokenizer)
def mistral_hf_predict(messages, mis_model = mis_model,
tokenizer = tokenizer, streamer = streamer,
do_sample = True,
top_p = 0.95,
top_k = 40,
max_new_tokens = 512,
max_input_length = 3500,
temperature = 0.9,
repetition_penalty = 1.0,
device = "cuda"):
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device)
generated_ids = mis_model.generate(model_inputs, max_new_tokens=max_new_tokens,
do_sample=do_sample,
streamer = streamer,
top_p = top_p,
top_k = top_k,
temperature = temperature,
repetition_penalty = repetition_penalty,
)
out = tokenizer.batch_decode(generated_ids)[0].split("[/INST]")[-1].replace("</s>", "").strip()
return out
out = mistral_hf_predict([
{
"role": "user",
"content": "不使用sorted,写一份简单的Python排序程序,使用markdown进行输出。"
}
],
repetition_penalty = 1.0,
temperature = 0.01,
max_new_tokens=1024
)
print(out)
Output
def sort_list(lst):
for i in range(len(lst)):
for j in range(i+1, len(lst)):
if lst[i] > lst[j]:
lst[i], lst[j] = lst[j], lst[i]
# 输入一个列表
lst = [5, 3, 8, 1, 6, 2, 7, 4]
# 调用sort_list函数进行排序
sort_list(lst)
# 输出排序后的列表
print("排序后的列表:")
print(lst)
输出:
排序后的列表:
[1, 2, 3, 4, 5, 6, 7, 8]
out = mistral_hf_predict([
{
"role": "user",
"content": "不使用sorted,写一份简单的Python排序程序,使用markdown进行输出。"
},
{ "role": "assistant",
"content": '''
```python
def sort_list(lst):
for i in range(len(lst)):
for j in range(i+1, len(lst)):
if lst[i] > lst[j]:
lst[i], lst[j] = lst[j], lst[i]
# 输入一个列表
lst = [5, 3, 8, 1, 6, 2, 7, 4]
# 调用sort_list函数进行排序
sort_list(lst)
# 输出排序后的列表
print("排序后的列表:")
print(lst)
```
输出:
```
排序后的列表:
[1, 2, 3, 4, 5, 6, 7, 8]
```
'''
},
{
"role": "user",
"content": "将上面的语言翻译成C++。"
}
],
repetition_penalty = 1.0,
temperature = 0.01,
max_new_tokens=1024
)
print(out)
Output
#include <iostream>
#include <algorithm>
using namespace std;
void sortList(int arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] > arr[j]) {
swap(arr[i], arr[j]);
}
}
}
}
int main() {
int arr[] = {5, 3, 8, 1, 6, 2, 7, 4};
int n = sizeof(arr) / sizeof(arr[0]);
sortList(arr, n);
cout << "Sorted array: ";
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << endl;
return 0;
}
输出:
Sorted array: 1 2 3 4 5 6 7 8
- Developed by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Model type: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
- Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
Training Details
Training Data
[More Information Needed]
Training Procedure
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]
Framework versions
- PEFT 0.11.0
- Downloads last month
- 0
Model tree for svjack/DPO_Bactrian_X_ZH_RJ_EN_ORPO_Mistral7B_v2_inst_lora_small
Base model
mistralai/Mistral-7B-Instruct-v0.2