Skip to content

Commit

Permalink
Relaxed dataset script path for pip package.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfelnlp committed Jul 3, 2021
1 parent fca36f7 commit d695cc9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ __Thermostat: A Large Collection of NLP Model Explanations and Analysis Tools.__
### With pip (coming soon!)

```bash
pip install thermostat
pip install thermostat-datasets
```


Expand Down Expand Up @@ -246,6 +246,10 @@ If you're successful, follow the official instructions for [sharing a community
At first, all Thermostat contributions will have to be loaded via the code example above. Please notify us of existing explanation datasets by creating an [Issue](https://github.com/DFKI-NLP/thermostat/issues) with the tag [Contribution](https://github.com/DFKI-NLP/thermostat/labels/contribution) and a maintainer of this repository will add your dataset to the Thermostat configs s.t. it can be accessed by everyone via `thermostat.load()`.


## Disclaimer
We give no warranties for the correctness of the heatmaps or any other part of the data. This is evolving work and will be hot-patched continuously.


## Acknowledgements

The majority of the codebase, especially regarding the combination of transformers and captum, stems from our other recent project [Empirical Explainers](https://github.com/DFKI-NLP/emp-exp).
6 changes: 5 additions & 1 deletion src/thermostat/data/dataset_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import os
from datasets import Dataset, load_dataset
from itertools import groupby
from overrides import overrides
Expand Down Expand Up @@ -344,7 +345,10 @@ def load(config_str: str = None, **kwargs) -> Thermopack:
print(f'Loading Thermostat configuration: {config_str}')
if ld_kwargs:
print(f'Additional parameters for loading: {ld_kwargs}')
data = load_dataset(path="src/thermostat/dataset.py", name=config_str, split="test", **ld_kwargs)
dataset_script_path = os.path.dirname(os.path.realpath(__file__)).replace('/thermostat/data',
'/thermostat/dataset.py')
data = load_dataset(path=dataset_script_path,
name=config_str, split="test", **ld_kwargs)

return Thermopack(data)

Expand Down
2 changes: 1 addition & 1 deletion src/thermostat/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
_HOMEPAGE = 'https://github.com/DFKI-NLP/thermostat'

# TODO: Add the licence for the dataset here if you can find it
_LICENSE = ''
_LICENSE = 'Apache 2.0'


class Thermostat(datasets.GeneratorBasedBuilder):
Expand Down

0 comments on commit d695cc9

Please sign in to comment.