Add model card
Browse files
README.md
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license: apache-2.0
|
5 |
+
tags:
|
6 |
+
- open-source
|
7 |
+
- code
|
8 |
+
- math
|
9 |
+
- chemistry
|
10 |
+
- biology
|
11 |
+
- text-generation
|
12 |
+
- question-answering
|
13 |
+
pipeline_tag: text-generation
|
14 |
+
---
|
15 |
+
# Locutusque/OpenCerebrum-2.0-7B AWQ
|
16 |
+
|
17 |
+
- Model creator: [Locutusque](https://huggingface.co/Locutusque)
|
18 |
+
- Original model: [OpenCerebrum-2.0-7B](https://huggingface.co/Locutusque/OpenCerebrum-2.0-7B)
|
19 |
+
|
20 |
+
## Model Summary
|
21 |
+
|
22 |
+
OpenCerebrum-2.0-7B is an open-source language model fine-tuned from the alpindale/Mistral-7B-v0.2-hf base model on a diverse dataset aimed at replicating capabilities of Aether Research's proprietary Cerebrum model.
|
23 |
+
|
24 |
+
The model was fine-tuned with SFT and DPO on approximately 7,000 examples across 15 data sources spanning coding, math, science, multi-turn conversation, RAG, reasoning, and general instruction-following. The goal was to assemble public datasets that could help the model achieve strong performance on benchmarks where Cerebrum excels.
|
25 |
+
|
26 |
+
## How to use
|
27 |
+
|
28 |
+
### Install the necessary packages
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install --upgrade autoawq autoawq-kernels
|
32 |
+
```
|
33 |
+
|
34 |
+
### Example Python code
|
35 |
+
|
36 |
+
```python
|
37 |
+
from awq import AutoAWQForCausalLM
|
38 |
+
from transformers import AutoTokenizer, TextStreamer
|
39 |
+
|
40 |
+
model_path = "solidrust/OpenCerebrum-2.0-7B-AWQ"
|
41 |
+
system_message = "You are Cerebrum, incarnated as a powerful AI."
|
42 |
+
|
43 |
+
# Load model
|
44 |
+
model = AutoAWQForCausalLM.from_quantized(model_path,
|
45 |
+
fuse_layers=True)
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path,
|
47 |
+
trust_remote_code=True)
|
48 |
+
streamer = TextStreamer(tokenizer,
|
49 |
+
skip_prompt=True,
|
50 |
+
skip_special_tokens=True)
|
51 |
+
|
52 |
+
# Convert prompt to tokens
|
53 |
+
prompt_template = """\
|
54 |
+
<|im_start|>system
|
55 |
+
{system_message}<|im_end|>
|
56 |
+
<|im_start|>user
|
57 |
+
{prompt}<|im_end|>
|
58 |
+
<|im_start|>assistant"""
|
59 |
+
|
60 |
+
prompt = "You're standing on the surface of the Earth. "\
|
61 |
+
"You walk one mile south, one mile west and one mile north. "\
|
62 |
+
"You end up exactly where you started. Where are you?"
|
63 |
+
|
64 |
+
tokens = tokenizer(prompt_template.format(system_message=system_message,prompt=prompt),
|
65 |
+
return_tensors='pt').input_ids.cuda()
|
66 |
+
|
67 |
+
# Generate output
|
68 |
+
generation_output = model.generate(tokens,
|
69 |
+
streamer=streamer,
|
70 |
+
max_new_tokens=512)
|
71 |
+
|
72 |
+
```
|
73 |
+
|
74 |
+
### About AWQ
|
75 |
+
|
76 |
+
AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
|
77 |
+
|
78 |
+
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
|
79 |
+
|
80 |
+
It is supported by:
|
81 |
+
|
82 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
83 |
+
- [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
|
84 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
85 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
86 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
87 |
+
|
88 |
+
## Prompt template: ChatML
|
89 |
+
|
90 |
+
```plaintext
|
91 |
+
<|im_start|>system
|
92 |
+
{system_message}<|im_end|>
|
93 |
+
<|im_start|>user
|
94 |
+
{prompt}<|im_end|>
|
95 |
+
<|im_start|>assistant
|
96 |
+
```
|