munish0838
commited on
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license_name: tongyi-qianwen-research
|
3 |
+
license_link: https://huggingface.co/Qwen/CodeQwen1.5-7B/blob/main/LICENSE
|
4 |
+
tags:
|
5 |
+
- code
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
license: other
|
8 |
+
base_model: NTQAI/Nxcode-CQ-7B-orpo
|
9 |
+
---
|
10 |
+
|
11 |
+
# QuantFactory/Nxcode-CQ-7B-orpo-GGUF
|
12 |
+
This is quantized version of [NTQAI/Nxcode-CQ-7B-orpo](https://huggingface.co/NTQAI/Nxcode-CQ-7B-orpo) created suing llama.cpp
|
13 |
+
|
14 |
+
## Model Description
|
15 |
+
|
16 |
+
Nxcode-CQ-7B-orpo is an [Monolithic Preference Optimization without Reference Model](https://arxiv.org/abs/2403.07691) fine-tune of Qwen/CodeQwen1.5-7B on 100k samples of high-quality ranking data.
|
17 |
+
|
18 |
+
## [Evalplus](https://github.com/evalplus/evalplus)
|
19 |
+
|
20 |
+
| EvalPlus | pass@1 |
|
21 |
+
| --- | --- |
|
22 |
+
| HumanEval | 86.6 |
|
23 |
+
| HumanEval+ | 83.5 |
|
24 |
+
| MBPP(v0.2.0) | 82.3 |
|
25 |
+
| MBPP+(v0.2.0) | 70.4 |
|
26 |
+
|
27 |
+
We use a simple template to generate the solution for evalplus:
|
28 |
+
|
29 |
+
```python
|
30 |
+
"Complete the following Python function:\n{prompt}"
|
31 |
+
```
|
32 |
+
|
33 |
+
[Evalplus Leaderboard](https://evalplus.github.io/leaderboard.html)
|
34 |
+
| Models | HumanEval | HumanEval+|
|
35 |
+
|------ | ------ | ------ |
|
36 |
+
| GPT-4-Turbo (April 2024)| 90.2| 86.6|
|
37 |
+
| GPT-4 (May 2023)| 88.4| 81.17|
|
38 |
+
| GPT-4-Turbo (Nov 2023)| 85.4| 79.3|
|
39 |
+
| CodeQwen1.5-7B-Chat| 83.5| 78.7|
|
40 |
+
| claude-3-opus (Mar 2024)| 82.9| 76.8|
|
41 |
+
| DeepSeek-Coder-33B-instruct| 81.1| 75.0|
|
42 |
+
| WizardCoder-33B-V1.1| 79.9| 73.2|
|
43 |
+
| OpenCodeInterpreter-DS-33B| 79.3| 73.8|
|
44 |
+
| speechless-codellama-34B-v2.0| 77.4| 72|
|
45 |
+
| GPT-3.5-Turbo (Nov 2023)| 76.8| 70.7|
|
46 |
+
| Llama3-70B-instruct| 76.2| 70.7|
|
47 |
+
|
48 |
+
## Bigcode Leaderboard
|
49 |
+
|
50 |
+
[Bigcode Leaderboard](https://huggingface.co/spaces/bigcode/bigcode-models-leaderboard)
|
51 |
+
|
52 |
+
**09/05/2024**
|
53 |
+
|
54 |
+
Top 1 average score.
|
55 |
+
|
56 |
+
Top 2 winrate.
|
57 |
+
|
58 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/5ee1b417636bdb3834e2da19/OQonD6a7aNjnN9SsTkFp-.png)
|
59 |
+
|
60 |
+
|
61 |
+
## Quickstart
|
62 |
+
|
63 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents. You should upgrade the transformers if you receive an error when loading the tokenizer
|
64 |
+
```python
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
device = "cuda" # the device to load the model onto
|
67 |
+
|
68 |
+
model = AutoModelForCausalLM.from_pretrained(
|
69 |
+
"NTQAI/Nxcode-CQ-7B-orpo",
|
70 |
+
torch_dtype="auto",
|
71 |
+
device_map="auto"
|
72 |
+
)
|
73 |
+
tokenizer = AutoTokenizer.from_pretrained("NTQAI/Nxcode-CQ-7B-orpo")
|
74 |
+
|
75 |
+
prompt = """Complete the following Python function:
|
76 |
+
from typing import List
|
77 |
+
|
78 |
+
|
79 |
+
def has_close_elements(numbers: List[float], threshold: float) -> bool:
|
80 |
+
""" Check if in given list of numbers, are any two numbers closer to each other than
|
81 |
+
given threshold.
|
82 |
+
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
|
83 |
+
False
|
84 |
+
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
|
85 |
+
True
|
86 |
+
"""
|
87 |
+
"""
|
88 |
+
messages = [
|
89 |
+
{"role": "user", "content": prompt}
|
90 |
+
]
|
91 |
+
|
92 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
93 |
+
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
|
94 |
+
res = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
|
95 |
+
|
96 |
+
```
|