Delete README.md
Browse files
README.md
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
datasets:
|
4 |
-
- wikitext
|
5 |
-
- ptb_text_only
|
6 |
-
language:
|
7 |
-
- en
|
8 |
-
metrics:
|
9 |
-
- perplexity
|
10 |
-
pipeline_tag: text-generation
|
11 |
-
model-index:
|
12 |
-
- name: distilgpt2
|
13 |
-
results:
|
14 |
-
- task:
|
15 |
-
type: text-generation
|
16 |
-
dataset:
|
17 |
-
name: penn_treebank
|
18 |
-
type: ptb_text_only
|
19 |
-
metrics:
|
20 |
-
- name: perlexity@BASELINE
|
21 |
-
type: dmx-perlexity
|
22 |
-
value: 63.45857238769531
|
23 |
-
- name: perlexity@FALLBACK
|
24 |
-
type: dmx-perlexity
|
25 |
-
value: 64.36720275878906
|
26 |
-
- task:
|
27 |
-
type: text-generation
|
28 |
-
dataset:
|
29 |
-
name: wikitext2
|
30 |
-
type: wikitext-2-raw-v1
|
31 |
-
metrics:
|
32 |
-
- name: perlexity@BASELINE
|
33 |
-
type: dmx-perlexity
|
34 |
-
value: 46.05925369262695
|
35 |
-
- name: perlexity@FALLBACK
|
36 |
-
type: dmx-perlexity
|
37 |
-
value: 46.570838928222656
|
38 |
-
---
|
39 |
-
This is a d-Matrix functional reference of the GPT2 model family, of the following *revisions*:
|
40 |
-
- [`distilgpt2`](https://huggingface.co/distilbert/distilgpt2)
|
41 |
-
- [`gpt2`](https://huggingface.co/openai-community/gpt2)
|
42 |
-
- [`gpt2-medium`](https://huggingface.co/openai-community/gpt2-medium)
|
43 |
-
- [`gpt2-large`](https://huggingface.co/openai-community/gpt2-large)
|
44 |
-
- [`gpt2-xl`](https://huggingface.co/openai-community/gpt2-xl)
|
45 |
-
|
46 |
-
The reference provides the following functional *configurations*:
|
47 |
-
Configuration | Explanation
|
48 |
-
:-- | :--
|
49 |
-
**`BASELINE`** | a reference functionally equivalent to the original model
|
50 |
-
**`BASIC`** | all linear algebraic operands quantized to `BFP16-64`, and all other operations transformed to approximated kernel simulations
|
51 |
-
|
52 |
-
|
53 |
-
### Usage
|
54 |
-
|
55 |
-
Prerequisites:
|
56 |
-
- Install d-Matrix ML Tools: `pip install dmx-mltools`
|
57 |
-
- clone this repo. `cd` to the cloned repo.
|
58 |
-
|
59 |
-
```python
|
60 |
-
>>> import os
|
61 |
-
>>> from mltools import dmx
|
62 |
-
>>> from transformers import pipeline
|
63 |
-
>>> import evaluate
|
64 |
-
>>> from datasets import load_dataset
|
65 |
-
|
66 |
-
>>> pipe = pipeline(
|
67 |
-
>>> "text-generation",
|
68 |
-
>>> model="d-matrix/gpt2",
|
69 |
-
>>> revision="gpt2-xl",
|
70 |
-
>>> dmx_config="BASELINE",
|
71 |
-
>>> use_auth_token=os.environ.get("HUGGING_FACE_HUB_TOKEN"),
|
72 |
-
>>> trust_remote_code=True,
|
73 |
-
>>> # device_map="auto", # enabling model parallel on multi-GPU nodes
|
74 |
-
>>> )
|
75 |
-
>>> pipe.model = dmx.Model(
|
76 |
-
>>> pipe.model, monkey_patched=False, hf=True, input_names=["input_ids", "labels"]
|
77 |
-
>>> )
|
78 |
-
|
79 |
-
>>> perplexity = evaluate.load("d-matrix/dmx_perplexity", module_type="metric")
|
80 |
-
>>> input_texts = load_dataset("ptb_text_only", "penn_treebank", split="test")["sentence"]
|
81 |
-
>>> results = perplexity.compute(model=pipe.model.body, references=input_texts)
|
82 |
-
>>> print(results)
|
83 |
-
{'loss': 3.0451672077178955, 'perplexity': 21.0135440826416}
|
84 |
-
```
|
85 |
-
|
86 |
-
### Evaluation results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|