Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fbd8874
Update keras import to fix build error.
sampathweb Apr 19, 2024
483082d
LIT: Refactor DataService reactions.
RyanMullins Apr 26, 2024
a5265a4
LIT: Add warm_start option to LitWidget
RyanMullins Apr 26, 2024
4fb3bde
Pretty-printing of Model objects
iftenney May 1, 2024
675ca2d
Add the helper function in Keras setup to clean up special tokens in …
bdu91 May 10, 2024
b16059f
Rename lm_salience_module to sequence_salience_module
RyanMullins May 22, 2024
b3c120b
LIT: Relax min Python version to 3.9
RyanMullins May 24, 2024
5188c8c
Relaxing SHAP version.
RyanMullins May 29, 2024
15eccb1
Simplify file_cache logic and re-enable for sequence salience demo.
iftenney May 30, 2024
f4c0990
No public description
a-googler Jun 3, 2024
6aa2eb6
Remove the image demo, models, dataset, and other related documentati…
llcourage Jun 4, 2024
c2fb41b
Remove the toxicity demos from the LIT examples.
llcourage Jun 5, 2024
dd196e9
Remove the xnli demos from the LIT examples.
llcourage Jun 5, 2024
72fd772
Remove the is_eval_demo from the LIT examples.
llcourage Jun 6, 2024
71d88fb
Remove the coref demo from the LIT examples.
llcourage Jun 6, 2024
aa49340
Remove the t5 demo, models, dataset, and other related documentation …
llcourage Jun 7, 2024
08289df
LIT: Improved packaging for prompt debugging code.
RyanMullins Jun 7, 2024
fc7b0d0
Move the glue demo to a self-contained directory.
llcourage Jun 10, 2024
2475b3b
LIT: Remove legacy Language Model demo.
RyanMullins Jun 12, 2024
a59641c
LIT: Move TyDI data into examples/tydi
RyanMullins Jun 12, 2024
0d8c0d9
LIT: Avoid equivalent shuffles in Scrambler
RyanMullins Jun 12, 2024
1ed82d4
LIT: Remove TFX model wrapper.
RyanMullins Jun 13, 2024
7d5ef58
LIT: Move model_utils to glue demo directory.
RyanMullins Jun 13, 2024
992823b
Minor updates on the model support in doc string post demo cleanup.
bdu91 Jun 17, 2024
3dad2b0
Remove LM prediction module.
llcourage Jun 18, 2024
0656386
Remove span graph module from LIT.
llcourage Jun 18, 2024
27d7a84
Remove attention module from LIT.
llcourage Jun 20, 2024
8863019
Fix import in TyDi model.
llcourage Jun 21, 2024
afd51fe
Update code links in LIT documentation to point to new demo locations.
llcourage Jun 21, 2024
e0e35c3
Fix a bug in the prompt debugging demo.
llcourage Jun 21, 2024
71cbdba
Fix for Remove attention module from LIT. Removed AttentionModule fro…
a-googler Jun 24, 2024
416d573
Remove the DALL-E demo from LIT. The package dependency could not be…
llcourage Jun 24, 2024
bcc481e
Update requirements.txt files for penguin demo, glue demo, and tydi d…
llcourage Jun 24, 2024
bb29f43
Add Jinja2 to penguin requirements.txt.
llcourage Jun 25, 2024
c7970fb
Update prompt_examples.jsonl path in MANIFEST.in.
llcourage Jun 25, 2024
7dda659
Internal change
RyanMullins Jun 25, 2024
79ada6e
LIT documentation update post demo cleanup.
bdu91 Jun 25, 2024
b14e3b1
Updated gunicorn config for demos running in Docker.
RyanMullins Jun 25, 2024
7ff377f
LIT: Disable embeddings for TyDi.
RyanMullins Jun 25, 2024
5639e3b
Update requirements.txt for TyDi example.
llcourage Jun 25, 2024
1c8d6a0
Update LIT documentation to reflect path changes in the codebase and …
cpka145 Jun 25, 2024
cee3b58
Fix typo in example command.
llcourage Jun 25, 2024
48b029c
Update colab examples to include installation of the lit-nlp package.
cpka145 Jun 25, 2024
2e9d267
More LIT documentation updates.
bdu91 Jun 25, 2024
5456011
Cast embeddings to float32 before computing distances.
llcourage Jun 25, 2024
998ed15
Website updates for v1.2 release
RyanMullins Jun 26, 2024
cba3188
Merge pull request #1524 from PAIR-code/website-1-2
bdu91 Jun 26, 2024
57c3ca3
LIT 1.2 release notes.
bdu91 Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename lm_salience_module to sequence_salience_module
PiperOrigin-RevId: 636277468
  • Loading branch information
RyanMullins authored and LIT team committed May 22, 2024
commit b16059fbd0320d411298009c0226489e1f548a69
22 changes: 12 additions & 10 deletions lit_nlp/api/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,15 @@ class LitModuleName(dtypes.EnumSerializableAsValues, enum.Enum):
Entries should map the TypeScript class name to the HTML element name,
as declared in HTMLElementTagNameMap in the .ts file defining each LitModule.
"""
AnnotatedTextModule = 'annotated-text-module'
# keep-sorted start
AnnotatedTextGoldModule = 'annotated-text-gold-module'
AnnotatedTextModule = 'annotated-text-module'
AttentionModule = 'attention-module'
ClassificationModule = 'classification-module'
ConfusionMatrixModule = 'confusion-matrix-module'
CurvesModule = 'curves-module'
DataTableModule = 'data-table-module'
SimpleDataTableModule = 'simple-data-table-module'
DatapointEditorModule = 'datapoint-editor-module'
# Non-replicating version of Datapoint Editor
SingleDatapointEditorModule = 'single-datapoint-editor-module'
# Simplified, non-replicating version of Datapoint Editor
SimpleDatapointEditorModule = 'simple-datapoint-editor-module'
DiveModule = 'dive-module'
DocumentationModule = 'documentation-module'
EmbeddingsModule = 'embeddings-module'
Expand All @@ -50,22 +46,28 @@ class LitModuleName(dtypes.EnumSerializableAsValues, enum.Enum):
GeneratedTextModule = 'generated-text-module'
GeneratorModule = 'generator-module'
LanguageModelPredictionModule = 'lm-prediction-module'
LMSalienceModule = 'lm-salience-module'
LegacySequenceSalienceModule = 'legacy-sequence-salience-module'
MetricsModule = 'metrics-module'
MultilabelModule = 'multilabel-module'
PdpModule = 'pdp-module'
RegressionModule = 'regression-module'
SalienceClusteringModule = 'salience-clustering-module'
SalienceMapModule = 'salience-map-module'
ScalarModule = 'scalar-module'
LegacySequenceSalienceModule = 'legacy-sequence-salience-module'
SequenceSalienceModule = 'sequence-salience-module'
SimpleDataTableModule = 'simple-data-table-module'
# Simplified, non-replicating version of Datapoint Editor
SimpleDatapointEditorModule = 'simple-datapoint-editor-module'
# Non-replicating version of Datapoint Editor
SingleDatapointEditorModule = 'single-datapoint-editor-module'
SpanGraphGoldModule = 'span-graph-gold-module'
SpanGraphModule = 'span-graph-module'
SpanGraphGoldModuleVertical = 'span-graph-gold-module-vertical'
SpanGraphModule = 'span-graph-module'
SpanGraphModuleVertical = 'span-graph-module-vertical'
TCAVModule = 'tcav-module'
TrainingDataAttributionModule = 'tda-module'
ThresholderModule = 'thresholder-module'
TrainingDataAttributionModule = 'tda-module'
# keep-sorted end

def __call__(self, **kw):
return ModuleConfig(self.value, **kw)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @fileoverview Custom viz module for causal LM salience.
* @fileoverview Custom viz module for sequence salience with causal LMs.
*/

import '@material/mwc-icon';
Expand All @@ -26,7 +26,7 @@ import {cleanSpmText, groupTokensByRegexPrefix, groupTokensByRegexSeparator} fro
import {type IndexedInput, type Preds, SCROLL_SYNC_CSS_CLASS, type Spec} from '../lib/types';
import {cumSumArray, filterToKeys, findSpecKeys, groupAlike, makeModifiedInput, sumArray} from '../lib/utils';

import {styles} from './lm_salience_module.css';
import {styles} from './sequence_salience_module.css';

/**
* Max of absolute value
Expand Down Expand Up @@ -133,10 +133,10 @@ export class SingleExampleSingleModelModule extends LitModule {
}

/**
* Custom styled version of <lit-token-chips> for rendering LM salience tokens.
* Custom styles for <lit-token-chips> to render sequence salience tokens.
*/
@customElement('lm-salience-chips')
class LMSalienceChips extends TextChips {
@customElement('sequence-salience-chips')
class SequenceSalienceChips extends TextChips {
@property({type: Boolean}) underline = false;

override holderClass() {
Expand Down Expand Up @@ -205,8 +205,8 @@ const CMAP_DEFAULT_RANGE = 0.4;
const DEFAULT_CUSTOM_SEGMENTATION_REGEX = '\\n+';

/** LIT module for model output. */
@customElement('lm-salience-module')
export class LMSalienceModule extends SingleExampleSingleModelModule {
@customElement('sequence-salience-module')
export class SequenceSalienceModule extends SingleExampleSingleModelModule {
static override title = 'Sequence Salience';
static override numCols = 6; // 60% of screen width if DataTable on left
static override duplicateAsRow = true;
Expand All @@ -215,9 +215,9 @@ export class LMSalienceModule extends SingleExampleSingleModelModule {
model: string,
selectionServiceIndex: number,
shouldReact: number,
) => html`<lm-salience-module model=${model} .shouldReact=${shouldReact}
) => html`<sequence-salience-module model=${model} .shouldReact=${shouldReact}
selectionServiceIndex=${selectionServiceIndex}>
</lm-salience-module>`;
</sequence-salience-module>`;

static override get styles() {
return [sharedStyles, styles];
Expand Down Expand Up @@ -561,7 +561,7 @@ export class LMSalienceModule extends SingleExampleSingleModelModule {
});

// If selected example OR selected target string change.
// NOTE: you may see a console warning: "Element lm-salience-module
// NOTE: you may see a console warning: "Element sequence-salience-module
// scheduled an update (generally because a property was set) after an
// update completed, causing a new update to be scheduled."
// This is okay here: this.modifiedData will be updated after
Expand Down Expand Up @@ -994,12 +994,12 @@ export class LMSalienceModule extends SingleExampleSingleModelModule {
// prettier-ignore
return html`
<div class='chip-container'>
<lm-salience-chips
<sequence-salience-chips
.tokensWithWeights=${segmentsWithWeights} .cmap=${this.cmap}
?dense=${this.denseView} ?vDense=${this.vDense}
?underline=${this.underline}
?preSpace=${this.denseView} breakNewlines>
</lm-salience-chips>
</sequence-salience-chips>
</div>
`;
}
Expand Down Expand Up @@ -1081,7 +1081,7 @@ export class LMSalienceModule extends SingleExampleSingleModelModule {

declare global {
interface HTMLElementTagNameMap {
'lm-salience-chips': LMSalienceChips;
'lm-salience-module': LMSalienceModule;
'sequence-salience-chips': SequenceSalienceChips;
'sequence-salience-module': SequenceSalienceModule;
}
}
}
21 changes: 13 additions & 8 deletions lit_nlp/examples/lm_salience_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
from lit_nlp import server_flags
from lit_nlp.api import layout
from lit_nlp.examples.datasets import lm as lm_data
from lit_nlp.lib import file_cache

# TODO(b/333698148): file_cache doesn't work well with certain HF and KerasNLP
# preset names. Disabling until resolved.
# from lit_nlp.lib import file_cache

# NOTE: additional flags defined in server_flags.py

Expand Down Expand Up @@ -132,7 +135,7 @@
"Editor": [modules.SingleDatapointEditorModule],
},
upper={ # if 'lower' not specified, this fills the right side
"Salience": [modules.LMSalienceModule],
"Salience": [modules.SequenceSalienceModule],
},
layoutSettings=layout.LayoutSettings(leftWidth=40),
description="Left/right layout for language model salience.",
Expand All @@ -143,7 +146,7 @@
"Editor": [modules.SimpleDatapointEditorModule],
},
lower={
"Salience": [modules.LMSalienceModule],
"Salience": [modules.SequenceSalienceModule],
},
layoutSettings=layout.LayoutSettings(
hideToolbar=True,
Expand All @@ -162,7 +165,7 @@
"Datapoint Generators": [modules.GeneratorModule],
},
lower={
"Salience": [modules.LMSalienceModule],
"Salience": [modules.SequenceSalienceModule],
"Metrics": [modules.MetricsModule],
},
layoutSettings=layout.LayoutSettings(
Expand Down Expand Up @@ -279,10 +282,12 @@ def main(argv: Sequence[str]) -> Optional[dev_server.LitServerType]:
model_name, path = model_string.split(":", 1)
logging.info("Loading model '%s' from '%s'", model_name, path)

path = file_cache.cached_path(
path,
extract_compressed_file=path.endswith(".tar.gz"),
)
# TODO(b/333698148): file_cache doesn't work well with certain HF and
# KerasNLP preset names. Disabling until resolved.
# path = file_cache.cached_path(
# path,
# extract_compressed_file=path.endswith(".tar.gz"),
# )

if _DL_FRAMEWORK.value == "kerasnlp":
# pylint: disable=g-import-not-at-top
Expand Down
2 changes: 1 addition & 1 deletion requirements_core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ filelock>=3.12.3
google-cloud-translate>=3.11.1
ipython>=7.34.0
Levenshtein>=0.21.1
matplotlib>=3.7.1
matplotlib>=3.6.0,<3.9.0
ml-collections>=0.1.1
numpy>=1.24.1
pandas>=2.0.3
Expand Down