bmah-dmx commited on
Commit
33cd0c3
·
verified ·
1 Parent(s): 0fdc193

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +34 -0
README.md CHANGED
@@ -1,3 +1,37 @@
1
  ---
2
  model_name: bert-base
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  model_name: bert-base
3
  ---
4
+ This is a d-Matrix functional reference of the BERT-BASE model.
5
+ The reference provides the following functional *configurations*:
6
+ Configuration | Explanation
7
+ :-- | :--
8
+ **`BASELINE`** | a reference functionally equivalent to the original model
9
+ **`BASIC`** | all linear algebraic operands quantized to `MXINT8-64`, and all other operations transformed to approximated kernel simulations
10
+
11
+
12
+ ### Usage
13
+
14
+ Install d-Matrix [Dmx_Compressor](https://github.com/d-matrix-ai/dmx-compressor) first.
15
+ ```sh
16
+ pip install dmx_compressor
17
+ ```
18
+
19
+ The following is an example model and its evaluation.
20
+
21
+ ```sh
22
+ pip install lm-eval
23
+ ```
24
+
25
+ ```python
26
+ from dmx.compressor.modeling import DmxModel
27
+ import lm_eval
28
+
29
+ model_args = f"pretrained="d-matrix/bert-base",trust_remote_code=True"
30
+
31
+ lm = lm_eval.api.registry.get_model("hf").create_from_arg_string(model_args, {"batch_size": 1})
32
+
33
+ # Transform the model with DMX
34
+ lm._model = DmxModel.from_torch(lm._model).to_basic_model() # Using BASIC configuration
35
+
36
+ eval_results = lm_eval.evaluate(lm, lm_eval.tasks.get_task_dict([task]) # Assign desired task, i.e. "wikitext"
37
+ ```