Skip to content

Commit 57c3ca3

Browse files
bdu91LIT team
authored andcommitted
LIT 1.2 release notes.
PiperOrigin-RevId: 646672631
1 parent cba3188 commit 57c3ca3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1475
-1484
lines changed

RELEASE.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,68 @@
11
# Learning Interpretability Tool Release Notes
22

3+
## Release 1.2
4+
5+
This release covers clean-ups on various obsolete demos, as well as improved
6+
packaging and isolated dependencies on the GLUE, Penguin, Prompt Debugging with
7+
Sequence Salience and TyDi demos for easier launch.
8+
9+
### New Stuff
10+
* Improved packaging and instructions for launching Prompt Debugging with
11+
Sequence Salience demo, as well as minor bug fixes -
12+
[08289df](https://github.com/PAIR-code/lit/commit/08289df0dd9927dee7147e5aad6e8b51bbe74f9e),
13+
[675ca2d](https://github.com/PAIR-code/lit/commit/675ca2de21b68dc62e4909c80a2cd57d8ee8b601),
14+
[15eccb1](https://github.com/PAIR-code/lit/commit/15eccb1197366c925a5beff310fb5d7d369bde0c),
15+
[e0e35c3](https://github.com/PAIR-code/lit/commit/e0e35c3ffcfd9ad5331d4154e7d33d0b1d0daf89),
16+
[c7970fb](https://github.com/PAIR-code/lit/commit/c7970fb8c51d2a8bd3647cc7eedd15cca285ac08),
17+
[cee3b58](https://github.com/PAIR-code/lit/commit/cee3b58baea2de27633109e6dd5b3e4211fa46ea)
18+
19+
* Clean up of obsolete demos -
20+
[b16059f](https://github.com/PAIR-code/lit/commit/b16059fbd0320d411298009c0226489e1f548a69),
21+
[f4c0990](https://github.com/PAIR-code/lit/commit/f4c099082f0e89986aad162cc3cd0ac9bc2214c7),
22+
[6aa2eb6](https://github.com/PAIR-code/lit/commit/6aa2eb64eddb8ca154401bfd6a039762bc374d6d),
23+
[c2fb41b](https://github.com/PAIR-code/lit/commit/c2fb41b4945edb91fac973cf0ddbca48c6257511),
24+
[dd196e9](https://github.com/PAIR-code/lit/commit/dd196e941058a1d4246b3df3a3c37595f9791b18),
25+
[72fd772](https://github.com/PAIR-code/lit/commit/72fd772fa02c7445f27fb517e667987ea8ab34d7),
26+
[71d88fb](https://github.com/PAIR-code/lit/commit/71d88fb86eb88ffb80d665cf7571b21d7ae06bd2),
27+
[aa49340](https://github.com/PAIR-code/lit/commit/aa493409c454a2ed269fdedd15353404c14b4936),
28+
[fc7b0d0](https://github.com/PAIR-code/lit/commit/fc7b0d0624f6cc8e456ac0a1d75a4149927bef2f),
29+
[2475b3b](https://github.com/PAIR-code/lit/commit/2475b3bb677c8685ab9a291c490783ae2ccce5b8),
30+
[a59641c](https://github.com/PAIR-code/lit/commit/a59641c014b17409e8e5cfdac1cc1e6916d6da15),
31+
[1ed82d4](https://github.com/PAIR-code/lit/commit/1ed82d4e81ff6a6ff5146b6198e35444960d326b),
32+
[7d5ef58](https://github.com/PAIR-code/lit/commit/7d5ef5831427de71416c096a6dbcd46ea064457e),
33+
[992823b](https://github.com/PAIR-code/lit/commit/992823b027fca8c60edabe837248a508ac04da22),
34+
[3dad2b0](https://github.com/PAIR-code/lit/commit/3dad2b061b45cb44b1c3f9b9364660e907662069),
35+
[0656386](https://github.com/PAIR-code/lit/commit/0656386188d6e4b6c83dab58fb4e6569ebea217e),
36+
[27d7a84](https://github.com/PAIR-code/lit/commit/27d7a841cf6d514e67ebfb2af9f603398499f6e3),
37+
[8863019](https://github.com/PAIR-code/lit/commit/886301972ec1e7ed274040b46ec0e0c3f34c8ace),
38+
[71cbdba](https://github.com/PAIR-code/lit/commit/71cbdbaee0fee8e96f52cd4df7a269a0873b9259),
39+
[416d573](https://github.com/PAIR-code/lit/commit/416d573d79f84b9a6964d36e498b850a249ef452)
40+
41+
* Python requirements update and isolated setup for individual demos -
42+
[bcc481e](https://github.com/PAIR-code/lit/commit/bcc481e44185d04268f5f8bb4ba762ec2cd35907),
43+
[bb29f43](https://github.com/PAIR-code/lit/commit/bb29f430ff7be55d74a82aec5dee1e54fa27bed0),
44+
[fbd8874](https://github.com/PAIR-code/lit/commit/fbd88746263fec0f72f2f01bcc382e88e902ab50),
45+
[b3c120b](https://github.com/PAIR-code/lit/commit/b3c120b22138fb03a712f11778197cf4966d0c3a),
46+
[5188c8c](https://github.com/PAIR-code/lit/commit/5188c8c835328efcc9dff5a0a4cf4cd79fabe099),
47+
[5639e3b](https://github.com/PAIR-code/lit/commit/5639e3b1b71b1c0ddf4a3c9e1bd25517fba18375)
48+
49+
* Documentation cleanup and updates -
50+
[afd51fe](https://github.com/PAIR-code/lit/commit/afd51fe299c0070a19946a789984957f14a9b5bb),
51+
[7dda659](https://github.com/PAIR-code/lit/commit/7dda659bec4e933d187b0d7afc04d954ae262cc2),
52+
[79ada6e](https://github.com/PAIR-code/lit/commit/79ada6edf8b2e485ec6a6425d4c60720b4dab8d1),
53+
[1c8d6a0](https://github.com/PAIR-code/lit/commit/1c8d6a0269ce5637e05e79ae435f770e2a0da147),
54+
[2e9d267](https://github.com/PAIR-code/lit/commit/2e9d26738d9344cde0eebd66d49dfc14cd800e74)
55+
56+
### Non-breaking Changes, Bug Fixes, and Enhancements
57+
* Refactor DataService reactions - [483082d](https://github.com/PAIR-code/lit/commit/483082dcb0beb39795c0fc093fe93036bb6a274c)
58+
* Add warm_start option to LitWidget - [a5265a4](https://github.com/PAIR-code/lit/commit/a5265a4feeb701b878986f79665d5fdf9ddc244c)
59+
* Pretty-printing of Model objects - [4fb3bde](https://github.com/PAIR-code/lit/commit/4fb3bde897c68fdeb3bd829f6e5a88223bc131a4)
60+
* Avoid equivalent shuffles in Scrambler - [0d8c0d9](https://github.com/PAIR-code/lit/commit/0d8c0d948480e0835fd3f451b95b7ec306b6409d)
61+
* Updated gunicorn config for demos running in Docker - [b14e3b1](https://github.com/PAIR-code/lit/commit/b14e3b1a81d7b6305063f778f46666a4d1326045)
62+
* Disable embeddings for TyDi - [7ff377f](https://github.com/PAIR-code/lit/commit/7ff377f92820748476e796994fd207e1b5dba1d9)
63+
* Cast embeddings to float32 before computing distances - [5456011](https://github.com/PAIR-code/lit/commit/5456011db8ead5d53db6f39bcdca3fc388802fbe)
64+
* Update colab examples to include installation of the lit-nlp package - [48b029c](https://github.com/PAIR-code/lit/commit/48b029c3a1a3f25d4d2611a9b0e94355d41078ef)
65+
366
## Release 1.1.1
467

568
This release covers various improvements for sequence salience, including new

docs/demos/index.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@
9898
<div class="demo-card-copy">Analyze a tabular data model with LIT, including exploring partial dependence plots and automatically finding counterfactuals.</div>
9999
<div class="demo-card-cta-button"><a href="/lit/demos/penguins.html"></a></div>
100100
</div>
101+
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
102+
<div class="demo-card-title"><a href="/lit/demos/images.html" target="_blank">Image classification</a></div>
103+
<div class="demo-card-tags"> <span class="demo-tag"> images </span> <span class="demo-tag"> multiclass classification </span>
104+
</div>
105+
<div class="demo-card-data-source-title">DATA SOURCES</div>
106+
<div class="demo-card-data-source">
107+
Imagenette
108+
</div>
109+
<div class="demo-card-copy">Analyze an image classification model with LIT, including multiple image salience techniques.</div>
110+
<div class="demo-card-cta-button"><a href="/lit/demos/images.html"></a></div>
111+
</div>
101112
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
102113
<div class="demo-card-title"><a href="/lit/demos/glue.html" target="_blank">Classification and regression models</a></div>
103114
<div class="demo-card-tags"> <span class="demo-tag"> BERT </span> <span class="demo-tag"> binary classification </span> <span class="demo-tag"> multi-class classification </span> <span class="demo-tag"> regression </span>
@@ -119,6 +130,50 @@
119130
</div>
120131
<div class="demo-card-copy">Use LIT directly inside a Colab notebook. Explore binary classification for sentiment analysis using SST2 from the General Language Understanding Evaluation (GLUE) benchmark suite.</div>
121132
<div class="demo-card-cta-button"><a href="https://colab.research.google.com/github/PAIR-code/lit/blob/main/lit_nlp/examples/notebooks/LIT_sentiment_classifier.ipynb"></a></div>
133+
</div>
134+
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
135+
<div class="demo-card-title"><a href="/lit/demos/coref.html" target="_blank">Gender bias in coreference systems</a></div>
136+
<div class="demo-card-tags"> <span class="demo-tag"> BERT </span> <span class="demo-tag"> coreference </span> <span class="demo-tag"> fairness </span> <span class="demo-tag"> Winogender </span>
137+
</div>
138+
<div class="demo-card-data-source-title">DATA SOURCES</div>
139+
<div class="demo-card-data-source">
140+
Winogender schemas
141+
</div>
142+
<div class="demo-card-copy">Use LIT to explore gendered associations in a coreference system, which matches pronouns to their antecedents. This demo highlights how LIT can work with structured prediction models (edge classification), and its capability for disaggregated analysis.</div>
143+
<div class="demo-card-cta-button"><a href="/lit/demos/coref.html"></a></div>
144+
</div>
145+
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
146+
<div class="demo-card-title"><a href="/lit/demos/lm.html" target="_blank">Fill in the blanks</a></div>
147+
<div class="demo-card-tags"> <span class="demo-tag"> BERT </span> <span class="demo-tag"> masked language model </span>
148+
</div>
149+
<div class="demo-card-data-source-title">DATA SOURCES</div>
150+
<div class="demo-card-data-source">
151+
Stanford Sentiment Treebank, Movie Reviews
152+
</div>
153+
<div class="demo-card-copy">Explore a BERT-based masked-language model. See what tokens the model predicts should fill in the blank when any token from an example sentence is masked out.</div>
154+
<div class="demo-card-cta-button"><a href="/lit/demos/lm.html"></a></div>
155+
</div>
156+
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
157+
<div class="demo-card-title"><a href="/lit/demos/t5.html" target="_blank">Text generation</a></div>
158+
<div class="demo-card-tags"> <span class="demo-tag"> T5 </span> <span class="demo-tag"> generation </span>
159+
</div>
160+
<div class="demo-card-data-source-title">DATA SOURCES</div>
161+
<div class="demo-card-data-source">
162+
CNN / Daily Mail
163+
</div>
164+
<div class="demo-card-copy">Use a T5 model to summarize text. For any example of interest, quickly find similar examples from the training set, using an approximate nearest-neighbors index.</div>
165+
<div class="demo-card-cta-button"><a href="/lit/demos/t5.html"></a></div>
166+
</div>
167+
<div class="demo-card mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet mdl-cell--4-col-phone">
168+
<div class="demo-card-title"><a href="/lit/demos/is_eval.html" target="_blank">Evaluating input salience methods</a></div>
169+
<div class="demo-card-tags"> <span class="demo-tag"> BERT </span> <span class="demo-tag"> salience </span> <span class="demo-tag"> evaluation </span>
170+
</div>
171+
<div class="demo-card-data-source-title">DATA SOURCES</div>
172+
<div class="demo-card-data-source">
173+
Stanford Sentiment Treebank, Toxicity
174+
</div>
175+
<div class="demo-card-copy">Explore the faithfulness of input salience methods on a BERT-base model across different datasets and artificial shortcuts.</div>
176+
<div class="demo-card-cta-button"><a href="/lit/demos/is_eval.html"></a></div>
122177
</div>
123178
</div>
124179
</div>
184 KB
Loading
89.5 KB
Loading
89.3 KB
Loading
144 KB
Loading
157 KB
Loading
248 KB
Loading
-122 KB
Loading

docs/documentation/_sources/api.md.txt

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LIT Python API
22

3-
<!--* freshness: { owner: 'lit-dev' reviewed: '2024-06-24' } *-->
3+
<!--* freshness: { owner: 'lit-dev' reviewed: '2023-08-23' } *-->
44

55
<!-- [TOC] placeholder - DO NOT REMOVE -->
66

@@ -349,7 +349,7 @@ list of scores for each token. The Integrated Gradients saliency method
349349
additionally requires a `TokenEmbeddings` input and corresponding output, as
350350
well as a label field `Target` to pin the gradient target to the same class as
351351
an input and corresponding output. See the
352-
[GLUE models class](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/glue/models.py)
352+
[GLUE models class](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/glue_models.py)
353353
for an example of these spec requirements.
354354

355355
The core API involves implementing the `run()` method:
@@ -675,7 +675,7 @@ Each `LitType` subclass encapsulates its own semantics (see
675675
* A field that appears in _both_ the model's input and output specs is assumed
676676
to represent the same value. This pattern is used for model-based input
677677
manipulation. For example, a
678-
[language model](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/glue/models.py)
678+
[language model](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/pretrained_lms.py)
679679
might output `'tokens': lit_types.Tokens(...)`, and accept as (optional)
680680
input `'tokens': lit_types.Tokens(required=False, ...)`. An interpretability
681681
component could take output from the former, swap one or more tokens (e.g.
@@ -712,9 +712,11 @@ this can cause jitter (UI modules appearing, disappearing, reordering, resizing,
712712
etc.) when switching between models or datasets with heterogeneous `Spec`s.
713713

714714
When implementing your own LIT components and modules, you can use
715-
[`utils.find_spec_keys()`][utils-lib-py] (Python) and
716-
[`findSpecKeys()`][utils-lib] (TypeScript) to identify fields of interest in a
717-
`Spec`. These methods recognize and respect subclasses. For example,
715+
[`utils.find_spec_keys()`][utils-lib]
716+
(Python) and
717+
[`findSpecKeys()`][utils-lib]
718+
(TypeScript) to identify fields of interest in a `Spec`. These methods recognize
719+
and respect subclasses. For example,
718720
`utils.find_spec_keys(spec, Scalar)` will also match any `RegressionScore`
719721
fields, but `utils.find_spec_keys(spec, RegressionScore)` will not return all
720722
`Scalar` fields in the `Spec`.
@@ -805,13 +807,8 @@ _See the [examples](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples)
805807

806808
### Available types
807809

808-
The full set of `LitType`s is defined in
809-
[types.py](https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/types.py). Numeric types
810-
such as `Integer` and `Scalar` have predefined ranges that can be overridden
811-
using corresponding `min_val` and `max_val` attributes as seen in
812-
[penguin data](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/penguin/data.py)
813-
`INPUT_SPEC`. The different types available in LIT are summarized in the table
814-
below.
810+
The full set of `LitType`s is defined in [types.py](https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/types.py). Numeric types such as `Integer` and `Scalar` have predefined ranges that can be overridden using corresponding `min_val` and `max_val` attributes as seen [here](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/datasets/penguin_data.py;l=19-22;rcl=574999438). The different types available in LIT are summarized
811+
in the table below.
815812

816813
Note: Bracket syntax, such as `<float>[num_tokens]`, refers to the shapes of
817814
NumPy arrays where each element inside the brackets is an integer.
@@ -862,7 +859,7 @@ naming collisions with protected TypeScript keywords.*
862859
Some properties of the LIT frontend can be configured from Python as
863860
**arguments to `dev_server.Server()`**. These include:
864861

865-
* `page_title`: set a custom page title.
862+
* `page_title`: set a custom page title, such as "Coreference Demo".
866863
* `canonical_url`: set a "canonical" URL (such as a shortlink) that will be
867864
used as the base when copying links from the LIT UI.
868865
* `default_layout`: set the default UI layout, by name. See `layout.ts` and
@@ -889,16 +886,22 @@ You can specify custom web app layouts from Python via the `layouts=` attribute.
889886
The value should be a `Mapping[str, LitCanonicalLayout]`, such as:
890887

891888
```python
892-
PENGUIN_LAYOUT = layout.LitCanonicalLayout(
889+
LM_LAYOUT = layout.LitCanonicalLayout(
893890
upper={
894-
'Main': [
895-
modules.DiveModule,
891+
"Main": [
892+
modules.EmbeddingsModule,
896893
modules.DataTableModule,
897894
modules.DatapointEditorModule,
898895
]
899896
},
900-
lower=layout.STANDARD_LAYOUT.lower,
901-
description='Custom layout for the Palmer Penguins demo.',
897+
lower={
898+
"Predictions": [
899+
modules.LanguageModelPredictionModule,
900+
modules.ConfusionMatrixModule,
901+
],
902+
"Counterfactuals": [modules.GeneratorModule],
903+
},
904+
description="Custom layout for language models.",
902905
)
903906
```
904907

@@ -909,12 +912,14 @@ lit_demo = dev_server.Server(
909912
models,
910913
datasets,
911914
# other args...
912-
layouts=layout.DEFAULT_LAYOUTS | {'penguins': PENGUIN_LAYOUT},
913-
default_layout='penguins',
915+
layouts={"lm": LM_LAYOUT},
914916
**server_flags.get_flags())
915917
return lit_demo.serve()
916918
```
917919

920+
For a full example, see
921+
[`lm_demo.py`](https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/lm_demo.py).
922+
918923
You can see the pre-configured layouts provided by LIT, as well as the list of
919924
modules that can be included in your custom layout in
920925
[`layout.py`](https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/layout.py). A
@@ -984,15 +989,15 @@ needing to reload the server or click the UI.
984989
For example, to view examples in a dataset:
985990

986991
```python
987-
from lit_nlp.examples.glue import data as glue_data
988-
dataset = glue_data.SST2Data('validation')
992+
from lit_nlp.examples.datasets import glue
993+
dataset = glue.SST2Data('validation')
989994
print(dataset.examples) # list of records {"sentence": ..., "label": ...}
990995
```
991996

992997
And to run inference on a few of them:
993998

994999
```python
995-
from lit_nlp.examples.glue import models as glue_models
1000+
from lit_nlp.examples.models import glue_models
9961001

9971002
model = glue_models.SST2Model("/path/to/model/files")
9981003
preds = list(model.predict(dataset.examples[:5]))
@@ -1016,19 +1021,16 @@ For a full working example in Colab, see [LIT_components_example.ipynb](https://
10161021
<!-- Links -->
10171022

10181023
[build-metadata]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/app.py
1019-
[components-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/components.py
1024+
[components-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/dataset.py
10201025
[curves-interp]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/components/curves.py
10211026
[dataset-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/dataset.py
10221027
[grad-maps]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/components/gradient_maps.py
10231028
[json]: https://www.json.org
10241029
[mnli-dataset]: https://cims.nyu.edu/~sbowman/multinli/
1025-
10261030
[mnli-demo]: https://pair-code.github.io/lit/demos/glue.html
1027-
1028-
[model-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/model.py
1031+
[model-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/dataset.py
10291032
[should_display_module]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/client/core/lit_module.ts
10301033
[types_py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/api/types.py
10311034
[types_ts]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/client/lib/lit_types.ts
10321035
[utils-lib]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/client/lib/utils.ts
1033-
[utils-lib-py]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/lib/utils.py
10341036
[word-replacer]: https://github.com/PAIR-code/lit/blob/main/lit_nlp/components/word_replacer.py

0 commit comments

Comments
 (0)