Skip to content

Commit

Permalink
Merge branch 'master' into abbreviation_replacement_op
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterhector authored May 18, 2022
2 parents a62c864 + 61c44ac commit 82da6ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Install Forte
run: |
pip install --use-feature=in-tree-build --progress-bar off .[data_aug,ir,remote,audio_ext,stave,models,test,wikipedia,nlp,extractor]
pip install --progress-bar off .[data_aug,ir,remote,audio_ext,stave,models,test,wikipedia,nlp,extractor]
- name: Install deep learning frameworks
run: |
pip install --progress-bar off torch==${{ matrix.torch-version }}
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
cd forte-wrappers
for d in ${{ matrix.notebook-details.dep }}; do pip install "src/"$d; done
cd ..
pip install --use-feature=in-tree-build --progress-bar off .[data_aug,ir,remote,audio_ext,stave,models,test,wikipedia,nlp,extractor]
pip install --progress-bar off .[data_aug,ir,remote,audio_ext,stave,models,test,wikipedia,nlp,extractor]
coverage run -m pytest tests/forte/notebooks
fi
test_backbone:
Expand All @@ -132,7 +132,7 @@ jobs:
- name: Test backbone Forte import test
run: |
# Try to install Forte backbone only and test basic imports.
pip install --use-feature=in-tree-build --progress-bar off .
pip install --progress-bar off .
python tests/forte/forte_backbone_test.py
test_modules:
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
${{ runner.os }}-
- name: install forte
run: |
pip install --use-feature=in-tree-build --progress-bar off .
pip install --progress-bar off .
- name: install dependencies
run: |
sudo apt-get install -y libsndfile1-dev
Expand All @@ -186,8 +186,8 @@ jobs:
rm -rf stave
- name: Test modules need extra packages
run: |
pip install --use-feature=in-tree-build --progress-bar off .[test]
pip install --use-feature=in-tree-build --progress-bar off .[${{ matrix.modules.module }}]
pip install --progress-bar off .[test]
pip install --progress-bar off .[${{ matrix.modules.module }}]
pip install --progress-bar off torch==${{ matrix.torch-version }}
pip install --progress-bar off pytest==5.1.3
pytest ${{ matrix.modules.test_file }}
Expand Down
22 changes: 13 additions & 9 deletions examples/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

The examples in this folder

- Build a pipeline using third-party tools like NLTK and StanfordNLP.
- Build a pipeline using third-party tools like NLTK and StanfordNLP.

- Demonstrate integration of processors developed using third-party tools into a single NLP
- Demonstrate integration of processors developed using third-party tools into a single NLP
pipeline.


Expand All @@ -18,7 +18,7 @@ pipeline.
pip install forte.nltk
```

- NER and SRL processors are built using texar-pytorch. Please follow the guidelines here
- NER and SRL processors are built using texar-pytorch. Please follow the guidelines here
https://github.com/asyml/texar-pytorch#installation to install it.

- To run `stanford_nlp_pipeline.py`, install Stanford NLP library using
Expand All @@ -38,29 +38,33 @@ For SRL,
python download_models.py --model-name srl
```


For NER,
```bash
python download_models.py --model-name ner
```
**Note**: the hyperlink for the ner model has been outdated and no longer valid. If you want to try out the pipeline, this [training example](https://github.com/petuum/composing_information_system/blob/main/training.md) have models and datasets to all the valid hyperlinks.


**Note**: The above script will save the model in `resources/`. Use `--path` option to save the

**Note**: The above script will save the model in `resources/`. Use `--path` option to save the
model into a different directory.

## Running the pipeline

`process_string_example.py` and `process_dataset_example.py` build the following pipeline

Reader -> NLTKSentenceSegmenter -> NLTKWordTokenizer -> NLTKPOSTagger -> NER Predictor ->
Reader -> NLTKSentenceSegmenter -> NLTKWordTokenizer -> NLTKPOSTagger -> NER Predictor ->
SRL Predictor

The configuration for NER and SRL Predictor are read from `config.yml` file and the processors are
initialized during the pipeline creation. To see the pipeline in action, run
The configuration for NER and SRL Predictor are read from `config.yml` file and the processors are
initialized during the pipeline creation. To see the pipeline in action, run

```bash
python pipeline_string_example.py
```

In `process_dataset_example.py`, we show the use of `process_dataset()` method of our pipeline
In `process_dataset_example.py`, we show the use of `process_dataset()` method of our pipeline
which is used to read text files from a directory as data packs. To run this example,

```bash
Expand All @@ -77,4 +81,4 @@ We run this pipeline on an English as well as French sentence. To see this actio

```bash
python stanford_nlp_pipeline.py
```
```

0 comments on commit 82da6ef

Please sign in to comment.