wanzin commited on
Commit
9f93075
Β·
2 Parent(s): f383068 5c75219

Merge branch 'main' of hf.co:spaces/d-matrix/dmxMetric

Browse files
Files changed (1) hide show
  1. README.md +68 -5
README.md CHANGED
@@ -1,13 +1,76 @@
1
  ---
2
- title: Dmx Lm Eval
3
- emoji: 🐒
4
- colorFrom: green
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 4.41.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
 
 
 
 
 
 
 
11
  ---
 
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: DmxMetric
3
+ emoji: πŸŒ–
4
+ colorFrom: purple
5
+ colorTo: pink
6
  sdk: gradio
7
  sdk_version: 4.41.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
+ tags:
12
+ - evaluate
13
+ - metric
14
+ description: >-
15
+ Evaluation function using lm-eval with d-Matrix integration.
16
+ This function allows for the evaluation of language models across various tasks,
17
+ with the option to use d-Matrix compressed models. For more information, see
18
+ https://github.com/EleutherAI/lm-evaluation-harness and https://github.com/d-matrix-ai/dmx-compressor
19
  ---
20
+ # Metric Card for dmxMetric
21
 
22
+ ## How to Use
23
+ ```python
24
+ >>>import evaluate
25
+ >>>metric = evaluate.load("d-matrix/dmxMetric", module_type="metric")
26
+ >>>results = metric._compute(model="d-matrix/gpt2",revision="distilgpt2",tasks="wikitext",dmx_config="BASIC" )
27
+ >>>print(results)
28
+ ```
29
+
30
+ ### Inputs
31
+ - **model** (`str`): The name or path of the model to evaluate.
32
+ - **tasks** (`Union[str, List[str]]`): The task or list of tasks to evaluate on.
33
+ - **dmx_config** (`Optional[str]`): Configuration string for d-Matrix transformations, defaults to None.
34
+ - **num_fewshot** (`Optional[int]`): Number of examples in few-shot context, defaults to None.
35
+ - **batch_size** (`Optional[Union[int, str]]`): Batch size for evaluation, defaults to None.
36
+ - **max_batch_size** (`Optional[int]`): Maximum batch size to try with automatic batch size detection, defaults to None.
37
+ - **limit** (`Optional[Union[int, float]]`): Limit the number of examples per task, defaults to None.
38
+ - **device** (`Optional[str]`): Device to run on, defaults to 'cuda' when available, otherwise 'cpu'.
39
+ - **revision** (`str`): Model revision to use, defaults to 'main'.
40
+ - **trust_remote_code** (`bool`): Whether to trust remote code, defaults to False.
41
+ - **log_samples** (`bool`): If True, logs all model outputs and documents, defaults to True.
42
+ - **verbosity** (`str`): Logging verbosity level, defaults to 'INFO'.
43
+ - **kwargs**: Additional keyword arguments to pass to `lm_eval.evaluate`.
44
+
45
+ ### Output Values
46
+ - **results** (`dict`): A dictionary containing the evaluation results for each task.
47
+
48
+ Output Example:
49
+ ```python
50
+ {
51
+ 'wikitext': {
52
+ 'alias': 'wikitext',
53
+ 'word_perplexity,none': 56.66175009356436,
54
+ 'word_perplexity_stderr,none': 'N/A',
55
+ 'byte_perplexity,none': 2.127521665015424,
56
+ 'byte_perplexity_stderr,none': 'N/A',
57
+ 'bits_per_byte,none': 1.0891738232631387,
58
+ 'bits_per_byte_stderr,none': 'N/A'
59
+ }
60
+ }
61
+ ```
62
+
63
+ This metric outputs a dictionary containing the evaluation results for each task. In this example, the results are shown for the 'wikitext' task. The output includes various perplexity and bits-per-byte metrics, along with their standard errors (where available). The specific metrics may include:
64
+
65
+ - `alias`: The name or alias of the task.
66
+ - `word_perplexity,none`: The perplexity calculated on a word level.
67
+ - `word_perplexity_stderr,none`: The standard error of the word perplexity (if available).
68
+ - `byte_perplexity,none`: The perplexity calculated on a byte level.
69
+ - `byte_perplexity_stderr,none`: The standard error of the byte perplexity (if available).
70
+ - `bits_per_byte,none`: The average number of bits required to encode each byte of the text.
71
+ - `bits_per_byte_stderr,none`: The standard error of the bits per byte metric (if available).
72
+
73
+ Note that 'N/A' values indicate that the standard error was not calculated or not available for that metric.
74
+
75
+ ## Citation(s)
76
+ https://github.com/EleutherAI/lm-evaluation-harness