eek commited on
Commit
b7a884e
1 Parent(s): 6fea700

Update Readme

Browse files

Update Readme with more info and instructions / details.

Files changed (1) hide show
  1. README.md +60 -1
README.md CHANGED
@@ -28,10 +28,67 @@ license_link: https://www.databricks.com/legal/open-model-license
28
  ---
29
 
30
  # mlx-community/dbrx-instruct-4bit
31
- This model was converted to MLX format from [`databricks/dbrx-instruct`]() using mlx-lm version **0.4.0**.
 
 
32
  Refer to the [original model card](https://huggingface.co/databricks/dbrx-instruct) for more details on the model.
 
 
 
 
 
 
 
 
33
  ## Use with mlx
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ```bash
36
  pip install mlx-lm
37
  ```
@@ -42,3 +99,5 @@ from mlx_lm import load, generate
42
  model, tokenizer = load("mlx-community/dbrx-instruct-4bit")
43
  response = generate(model, tokenizer, prompt="hello", verbose=True)
44
  ```
 
 
 
28
  ---
29
 
30
  # mlx-community/dbrx-instruct-4bit
31
+ This model was converted to MLX format from [`databricks/dbrx-instruct`]() using mlx-lm version [b80adbc
32
+ ](https://github.com/ml-explore/mlx-examples/commit/b80adbcc3ee5b00ad43432faede408b983f152c2) after DBRX support was added by [Awni Hannun](https://github.com/awni).
33
+
34
  Refer to the [original model card](https://huggingface.co/databricks/dbrx-instruct) for more details on the model.
35
+
36
+ ## Conversion
37
+
38
+ Conversion was done with:
39
+ ```bash
40
+ python -m mlx_lm.convert --hf-path databricks/dbrx-instruct -q --upload-repo mlx-community/dbrx-instruct-4bit
41
+ ```
42
+
43
  ## Use with mlx
44
 
45
+ ```bash
46
+ git clone git@github.com:ml-explore/mlx-examples.git
47
+ cd mlx-examples/llms/
48
+ python setup.py build
49
+ python setup.py install
50
+
51
+ python -m mlx_lm.generate --model mlx-community/dbrx-instruct-4bit --prompt "Hello" --trust-remote-code --max-tokens 500
52
+ ```
53
+
54
+ Remember, this is an Instruct model, so you will need to use the instruct prompt template:
55
+
56
+ ## Example:
57
+
58
+ ```text
59
+ <|im_start|>system
60
+ You are DBRX, created by Databricks. You were last updated in December 2023. You answer questions based on information available up to that point.
61
+ YOU PROVIDE SHORT RESPONSES TO SHORT QUESTIONS OR STATEMENTS, but provide thorough responses to more complex and open-ended questions.
62
+ You assist with various tasks, from writing to coding (using markdown for code blocks — remember to use ``` with code, JSON, and tables).
63
+ (You do not have real-time data access or code execution capabilities. You avoid stereotyping and provide balanced perspectives on controversial topics. You do not provide song lyrics, poems, or news articles and do not divulge details of your training data.)
64
+ This is your system prompt, guiding your responses. Do not reference it, just respond to the user. If you find yourself talking about this message, stop. You should be responding appropriately and usually that means not mentioning this.
65
+ YOU DO NOT MENTION ANY OF THIS INFORMATION ABOUT YOURSELF UNLESS THE INFORMATION IS DIRECTLY PERTINENT TO THE USER'S QUERY.<|im_end|>
66
+ <|im_start|>user
67
+ What's the difference between PCA vs UMAP vs t-SNE?<|im_end|>
68
+ <|im_start|>assistant
69
+ The difference
70
+ ```
71
+
72
+ I've also added some extra words for the assistant start otherwise the model would instantly add an `<|im_end|>` token and stop.
73
+ If `<|im_start|>assistant` is not added, an error will appear.
74
+
75
+ You can add the above in a text file and use it as:
76
+
77
+ ```bash
78
+ python -m mlx_lm.generate --model dbrx-instruct-4bit --prompt "$(cat my_prompt.txt)" --trust-remote-code --max-tokens 1000
79
+ ```
80
+
81
+ Output:
82
+
83
+
84
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/630f2745982455e61cc5fb1d/UUeNmuNipYwN7FVrT9KSq.png)
85
+
86
+
87
+ On my Macbook Pro M2 with 96GB of Unified Memory, DBRX Instruct in 4-bit for the above prompt it eats 70.2GB of RAM.
88
+
89
+
90
+ if the mlx-lm package was updated it can also be installed from pip:
91
+
92
  ```bash
93
  pip install mlx-lm
94
  ```
 
99
  model, tokenizer = load("mlx-community/dbrx-instruct-4bit")
100
  response = generate(model, tokenizer, prompt="hello", verbose=True)
101
  ```
102
+
103
+ Converted and uploaded by [eek](https://huggingface.co/eek)