Skip to content

Commit

Permalink
Merge pull request #15 from aj280192/main
Browse files Browse the repository at this point in the history
Adding layer deeplift shap and layer gradient shap explainers.
  • Loading branch information
nfelnlp authored Mar 18, 2022
2 parents c1d5323 + 461bdd0 commit f21ed3f
Show file tree
Hide file tree
Showing 40 changed files with 4,353 additions and 528 deletions.
31 changes: 31 additions & 0 deletions configs/ag_news/albert/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "textattack/albert-base-v2-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/ag_news/albert/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "textattack/albert-base-v2-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
31 changes: 31 additions & 0 deletions configs/ag_news/bert/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "textattack/bert-base-uncased-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/ag_news/bert/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "textattack/bert-base-uncased-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
31 changes: 31 additions & 0 deletions configs/ag_news/roberta/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "textattack/roberta-base-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/ag_news/roberta/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "ag_news",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "textattack/roberta-base-ag-news",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
31 changes: 31 additions & 0 deletions configs/imdb/albert/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "textattack/albert-base-v2-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/imdb/albert/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "textattack/albert-base-v2-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
31 changes: 31 additions & 0 deletions configs/imdb/bert/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'special_tokens_mask', 'token_type_ids', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "textattack/bert-base-uncased-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/imdb/bert/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'special_tokens_mask', 'token_type_ids', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "textattack/bert-base-uncased-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
31 changes: 31 additions & 0 deletions configs/imdb/electra/lds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerDeepLiftShap",
},
"model": {
"name": "monologg/electra-small-finetuned-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
32 changes: 32 additions & 0 deletions configs/imdb/electra/lgs.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"path": "$HOME/experiments/thermostat",
"device": "cuda",
"dataset": {
"name": "imdb",
"split": "test",
"columns": ['input_ids', 'attention_mask', 'token_type_ids', 'special_tokens_mask', 'labels'],
"batch_size": 1,
"root_dir": "$HOME/experiments/thermostat/datasets",
},
"explainer": {
"name": "LayerGradientShap",
"n_samples": 5,
},
"model": {
"name": "monologg/electra-small-finetuned-imdb",
"mode_load": "hf",
"path_model": null,
"tokenization": {
"max_length": 512,
"padding": "max_length",
"return_tensors": "np",
"truncation": true,
"special_tokens_mask": true,
}
},
"visualization": {
"columns": ["attributions", "predictions", "input_ids", "labels"],
"gamma": 2.0,
"normalize": true,
}
}
Loading

0 comments on commit f21ed3f

Please sign in to comment.