Permalink
Browse files

Initial commit

fbshipit-source-id: 37fcde1d9030593a46b2d6384e5aeb6ab74fc6ea
  • Loading branch information...
facebook-github-bot committed Dec 11, 2018
0 parents commit a64370c7f1aac1c0491ccf5b2b0987909c9e0d94
Showing with 21,820 additions and 0 deletions.
  1. +50 −0 .circleci/config.yml
  2. +6 −0 .circleci/setup_circleimg.sh
  3. +4 −0 .coveragerc
  4. +33 −0 .gitignore
  5. +33 −0 CLOUDS.md
  6. +5 −0 CODE_OF_CONDUCT.md
  7. +34 −0 CONTRIBUTING.md
  8. +30 −0 LICENSE
  9. +59 −0 README.md
  10. +9 −0 activation_venv
  11. +14 −0 activation_venv.bat
  12. +83 −0 demo/atis_joint_model/atis_joint_config.json
  13. +199 −0 demo/atis_joint_model/data_processor.py
  14. +19 −0 demo/configs/distributed_docnn.json
  15. +11 −0 demo/configs/docnn.json
  16. +78 −0 demo/configs/multitask_sst_lm.json
  17. +83 −0 demo/configs/rnng.json
  18. +25 −0 demo/configs/sst2.json
  19. +77 −0 demo/flask_server/atis.py
  20. +19 −0 demo/flask_server/server.py
  21. +14 −0 demo/flask_server/setup.sh
  22. +85 −0 demo/predictor_service/Dockerfile
  23. +16 −0 demo/predictor_service/Makefile
  24. +8 −0 demo/predictor_service/predictor.thrift
  25. +250 −0 demo/predictor_service/server.cpp
  26. +3 −0 install_deps
  27. +4 −0 install_deps.bat
  28. +3 −0 pytest.ini
  29. +65 −0 pytext/__init__.py
  30. +33 −0 pytext/builtin_task.py
  31. +77 −0 pytext/common/constants.py
  32. +2 −0 pytext/common/tests/common_test.py
  33. +5 −0 pytext/config/__init__.py
  34. +203 −0 pytext/config/component.py
  35. +39 −0 pytext/config/contextual_intent_slot.py
  36. +38 −0 pytext/config/doc_classification.py
  37. +79 −0 pytext/config/field_config.py
  38. +36 −0 pytext/config/module_config.py
  39. +21 −0 pytext/config/pair_classification.py
  40. +109 −0 pytext/config/pytext_config.py
  41. +213 −0 pytext/config/serialize.py
  42. +125 −0 pytext/config/test/component_test.py
  43. +273 −0 pytext/config/test/pytext_config_test.py
  44. +30 −0 pytext/data/__init__.py
  45. +214 −0 pytext/data/bptt_lm_data_handler.py
  46. +203 −0 pytext/data/compositional_data_handler.py
  47. +231 −0 pytext/data/contextual_intent_slot_data_handler.py
  48. +711 −0 pytext/data/data_handler.py
  49. +621 −0 pytext/data/data_structures/annotation.py
  50. +75 −0 pytext/data/data_structures/tests/annotation_test.py
  51. +155 −0 pytext/data/disjoint_multitask_data_handler.py
  52. +150 −0 pytext/data/doc_classification_data_handler.py
  53. +8 −0 pytext/data/featurizer/__init__.py
  54. +58 −0 pytext/data/featurizer/featurizer.py
  55. +63 −0 pytext/data/featurizer/simple_featurizer.py
  56. +163 −0 pytext/data/joint_data_handler.py
  57. +155 −0 pytext/data/language_model_data_handler.py
  58. +82 −0 pytext/data/pair_classification_data_handler.py
  59. +79 −0 pytext/data/seq_data_handler.py
  60. +57 −0 pytext/data/test/bptt_lm_data_handler_test.py
  61. +230 −0 pytext/data/test/compositional_datahandler_test.py
  62. +55 −0 pytext/data/test/contextual_intent_slot_data_handler_test.py
  63. +43 −0 pytext/data/test/datahandler_test.py
  64. +60 −0 pytext/data/test/doc_classification_data_handler_test.py
  65. +66 −0 pytext/data/test/joint_data_handler_test.py
  66. +120 −0 pytext/data/test/language_model_data_handler_test.py
  67. +67 −0 pytext/data/test/seq_data_handler_test.py
  68. +61 −0 pytext/data/test/simple_featurizer_test.py
  69. +28 −0 pytext/docs/Makefile
  70. +2 −0 pytext/docs/requirements.txt
  71. BIN pytext/docs/source/_static/img/flask_www.png
  72. BIN pytext/docs/source/_static/img/ios_demo.png
  73. BIN pytext/docs/source/_static/img/pytext_design.png
  74. +158 −0 pytext/docs/source/atis_tutorial.rst
  75. +167 −0 pytext/docs/source/conf.py
  76. +370 −0 pytext/docs/source/create_new_task.rst
  77. +148 −0 pytext/docs/source/disjoint_multitask_tutorial.rst
  78. +72 −0 pytext/docs/source/distributed_training_tutorial.rst
  79. +171 −0 pytext/docs/source/execute_your_first_model.rst
  80. +86 −0 pytext/docs/source/hierarchical_intent_slot_tutorial.rst
  81. +75 −0 pytext/docs/source/index.rst
  82. +93 −0 pytext/docs/source/installation.rst
  83. +19 −0 pytext/docs/source/models.rst
  84. +115 −0 pytext/docs/source/overview.rst
  85. +79 −0 pytext/docs/source/pytext_models_in_your_app.rst
  86. +267 −0 pytext/docs/source/serving_models_in_production.rst
  87. +131 −0 pytext/docs/source/train_your_first_model.rst
  88. +7 −0 pytext/exporters/__init__.py
  89. +213 −0 pytext/exporters/exporter.py
  90. +678 −0 pytext/exporters/test/text_model_exporter_test.py
  91. +47 −0 pytext/fields/__init__.py
  92. +97 −0 pytext/fields/char_field.py
  93. +105 −0 pytext/fields/dict_field.py
  94. +321 −0 pytext/fields/field.py
  95. +62 −0 pytext/fields/pretrained_model_embedding_field.py
  96. +109 −0 pytext/fields/test/char_field_test.py
  97. +62 −0 pytext/fields/test/dict_field_test.py
  98. +61 −0 pytext/fields/test/field_test.py
  99. +141 −0 pytext/fields/text_field_with_special_unk.py
  100. +6 −0 pytext/loss/__init__.py
  101. +226 −0 pytext/loss/loss.py
  102. +225 −0 pytext/main.py
  103. +21 −0 pytext/metric_reporters/__init__.py
  104. +244 −0 pytext/metric_reporters/channel.py
  105. +57 −0 pytext/metric_reporters/classification_metric_reporter.py
  106. +134 −0 pytext/metric_reporters/compositional_metric_reporter.py
  107. +35 −0 pytext/metric_reporters/disjoint_multitask_metric_reporter.py
  108. +186 −0 pytext/metric_reporters/intent_slot_detection_metric_reporter.py
  109. +52 −0 pytext/metric_reporters/language_model_metric_reporter.py
  110. +201 −0 pytext/metric_reporters/metric_reporter.py
  111. +59 −0 pytext/metric_reporters/tests/compositional_metric_reporter_test.py
  112. +45 −0 pytext/metric_reporters/tests/intent_slot_metric_reporter_test.py
  113. +85 −0 pytext/metric_reporters/word_tagging_metric_reporter.py
  114. +548 −0 pytext/metrics/__init__.py
  115. +472 −0 pytext/metrics/intent_slot_metrics.py
  116. +28 −0 pytext/metrics/language_model_metrics.py
  117. +86 −0 pytext/metrics/tests/basic_metrics_test.py
  118. +499 −0 pytext/metrics/tests/intent_slot_metrics_test.py
  119. +27 −0 pytext/metrics/tests/metrics_test_base.py
  120. +6 −0 pytext/models/__init__.py
  121. +293 −0 pytext/models/crf.py
  122. +9 −0 pytext/models/decoders/__init__.py
  123. +42 −0 pytext/models/decoders/decoder_base.py
  124. +84 −0 pytext/models/decoders/intent_slot_model_decoder.py
  125. +59 −0 pytext/models/decoders/mlp_decoder.py
  126. +59 −0 pytext/models/disjoint_multitask_model.py
  127. +57 −0 pytext/models/distributed_model.py
  128. +35 −0 pytext/models/doc_model.py
  129. +18 −0 pytext/models/embeddings/__init__.py
  130. +119 −0 pytext/models/embeddings/char_embedding.py
  131. +121 −0 pytext/models/embeddings/dict_embedding.py
  132. +34 −0 pytext/models/embeddings/embedding_base.py
  133. +112 −0 pytext/models/embeddings/embedding_list.py
  134. +25 −0 pytext/models/embeddings/pretrained_model_embedding.py
  135. +100 −0 pytext/models/embeddings/word_embedding.py
  136. +7 −0 pytext/models/ensembles/__init__.py
  137. +43 −0 pytext/models/ensembles/bagging_doc_ensemble.py
  138. +91 −0 pytext/models/ensembles/bagging_intent_slot_ensemble.py
  139. +73 −0 pytext/models/ensembles/ensemble.py
  140. +53 −0 pytext/models/joint_model.py
  141. +143 −0 pytext/models/language_models/lmlstm.py
  142. +288 −0 pytext/models/model.py
  143. +74 −0 pytext/models/module.py
  144. +16 −0 pytext/models/output_layers/__init__.py
  145. +90 −0 pytext/models/output_layers/doc_classification_output_layer.py
  146. +146 −0 pytext/models/output_layers/intent_slot_output_layer.py
  147. +110 −0 pytext/models/output_layers/lm_output_layer.py
  148. +125 −0 pytext/models/output_layers/output_layer_base.py
  149. +33 −0 pytext/models/output_layers/utils.py
  150. +220 −0 pytext/models/output_layers/word_tagging_output_layer.py
  151. +56 −0 pytext/models/pair_classification_model.py
  152. +119 −0 pytext/models/representations/bilstm.py
  153. +121 −0 pytext/models/representations/bilstm_doc_attention.py
  154. +155 −0 pytext/models/representations/bilstm_doc_slot_attention.py
  155. +103 −0 pytext/models/representations/bilstm_slot_attn.py
  156. +127 −0 pytext/models/representations/biseqcnn.py
  157. +76 −0 pytext/models/representations/contextual_intent_slot_rep.py
  158. +44 −0 pytext/models/representations/docnn.py
  159. +27 −0 pytext/models/representations/jointcnn_rep.py
  160. +147 −0 pytext/models/representations/pair_rep.py
  161. +107 −0 pytext/models/representations/pooling.py
  162. +72 −0 pytext/models/representations/pure_doc_attention.py
  163. +19 −0 pytext/models/representations/representation_base.py
  164. +48 −0 pytext/models/representations/seq_rep.py
  165. +71 −0 pytext/models/representations/slot_attention.py
  166. +182 −0 pytext/models/semantic_parsers/rnng/rnng_data_structures.py
  167. +611 −0 pytext/models/semantic_parsers/rnng/rnng_parser.py
  168. +68 −0 pytext/models/seq_models/contextual_intent_slot.py
  169. +22 −0 pytext/models/seq_models/seqnn.py
  170. +98 −0 pytext/models/test/crf_test.py
  171. +29 −0 pytext/models/test/embedding_list_test.py
  172. +51 −0 pytext/models/test/module_test.py
  173. +31 −0 pytext/models/test/word_embedding_test.py
  174. +32 −0 pytext/models/word_model.py
  175. +47 −0 pytext/optimizer/__init__.py
  176. +255 −0 pytext/optimizer/scheduler.py
  177. +8 −0 pytext/task/__init__.py
  178. +87 −0 pytext/task/disjoint_multitask.py
  179. +50 −0 pytext/task/serialize.py
  180. +225 −0 pytext/task/task.py
  181. +209 −0 pytext/task/tasks.py
  182. +8 −0 pytext/trainers/__init__.py
  183. +59 −0 pytext/trainers/ensemble_trainer.py
  184. +93 −0 pytext/trainers/hogwild_trainer.py
  185. +236 −0 pytext/trainers/trainer.py
  186. +43 −0 pytext/utils/cuda_utils.py
  187. +172 −0 pytext/utils/data_utils.py
  188. +36 −0 pytext/utils/dist_utils.py
  189. +149 −0 pytext/utils/documentation_helper.py
  190. +190 −0 pytext/utils/embeddings_utils.py
  191. +194 −0 pytext/utils/loss_utils.py
  192. +18 −0 pytext/utils/model_utils.py
  193. +164 −0 pytext/utils/onnx_utils.py
  194. +6 −0 pytext/utils/python_utils.py
  195. +135 −0 pytext/utils/test_utils.py
  196. +65 −0 pytext/utils/tests/embeddings_utils_test.py
  197. +7 −0 pytext/utils/tests/pretrained_embed_raw
  198. +166 −0 pytext/utils/tests/test_samples.json
  199. +53 −0 pytext/utils/tests/utils_test.py
  200. +120 −0 pytext/workflow.py
  201. +11 −0 requirements.txt
  202. +26 −0 setup.py
  203. 0 tests/__init__.py
  204. +5 −0 tests/data/alarm_lm_tiny.tsv
  205. +10 −0 tests/data/compositional_seq2seq_unit.tsv
  206. +5 −0 tests/data/contextual_intent_slot_test_tiny.tsv
  207. +10 −0 tests/data/contextual_intent_slot_train_tiny.tsv
  208. +11 −0 tests/data/pretrained_embed_raw
  209. +5 −0 tests/data/test_data_tiny.tsv
  210. +5 −0 tests/data/test_dense_features_tiny.tsv
  211. BIN tests/data/test_embed.cached
  212. +11 −0 tests/data/test_embed.raw
  213. BIN tests/data/test_embed_xlu.cached
  214. +10 −0 tests/data/train_data_tiny.tsv
  215. +10 −0 tests/data/train_dense_features_tiny.tsv
  216. +10 −0 tests/data/train_tiny_with_lang.tsv
  217. +13 −0 tests/data_utils.py
  218. +32 −0 tests/model_utils_test.py
  219. +109 −0 tests/module_load_save_test.py
  220. +192 −0 tests/pretrained_embeds_test.py
@@ -0,0 +1,50 @@
version: 2
jobs:
build_Py3.6:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run:
name: setup
command: source .circleci/setup_circleimg.sh
- run:
name: install_pytorch
command: sudo pip install --progress-bar off http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl
- run:
name: run tests and gather coverage
command: pytest --junitxml=test-reports/junit.xml --cov=pytext --cov-report=html:htmlcov
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
- store_artifacts:
path: htmlcov
destination: coverage
build_Py3.7:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: setup
command: source .circleci/setup_circleimg.sh
- run:
name: install_pytorch
command: sudo pip install --progress-bar off http://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-linux_x86_64.whl
- run:
name: run tests and gather coverage
command: pytest --junitxml=test-reports/junit.xml --cov=pytext --cov-report=html:htmlcov
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
- store_artifacts:
path: htmlcov
destination: coverage
workflows:
version: 2
build_and_test:
jobs:
- build_Py3.6
- build_Py3.7
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
sudo apt-get update
sudo apt-get install -y cmake python-pip python-dev build-essential protobuf-compiler libprotoc-dev
sudo ./install_deps
sudo pip install --progress-bar off pytest pytest-cov
@@ -0,0 +1,4 @@
[run]
branch = True
concurrency = multiprocessing
include = pytext/*
@@ -0,0 +1,33 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codi]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
eggs/
.eggs/
*.egg-info/
.installed.cfg
*.egg

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Backups
*~

# Coverage Files
.coverage
@@ -0,0 +1,33 @@
# Getting Started on a Cloud VM

This document should help you quickly get up and running with a GPU attached Virtual Machine in the major cloud services. This guide will cover all the setup work you have to do in order to be able to easily install PyText.
Note that while these instructions worked when they were written, they may become incorrect or out of date. If they do, please send us a Pull Request!

## Amazon Web Services
**Coming Soon**

## Google Cloud Engine

*If you have problems launching your VM, make sure you have a non-zero gpu quota, [click here to learn about quotas](https://cloud.google.com/compute/quotas#requesting_additional_quota)*

This guide uses [Google's Deep Learning VM](https://console.cloud.google.com/marketplace/details/click-to-deploy-images/deeplearning) as a base.

* Click "Launch on Compute Engine"
* Configure the VM:
* Configure the hardware to match your desire/budget, the size you need will be determined by the data and model you use, but basic tasks like the ATIS tuturial can be run on the default 2 CPU 13.5 GB ram setup.
* For Framework, select one of the Base images, rather than one with a framework pre-installed. Note which version of CUDA you choose for later.
* When you're ready, click "Deploy"
* When your VM is done loading, you can SSH into it from the GCE Console
* Install Python 3.6 (based on [this RoseHosting blog post](https://www.rosehosting.com/blog/how-to-install-python-3-6-4-on-debian-9/)):
* `$ sudo nano /etc/apt/sources.list`
* add `deb http://ftp.de.debian.org/debian testing main` to the list
* `$ echo 'APT::Default-Release "stable";' | sudo tee -a /etc/apt/apt.conf.d/00local`
* `$ sudo apt-get update`
* `$ sudo apt-get -t testing install python3.6`
* `$ sudo apt-get install python3.6-venv`
* Follow the [install instructions](INSTALL.md) for Ubuntu/Debian
* Follow the [Getting Started Instrutions](README.md) to download and setup PyText


## Microsoft Azure
**Coming Soon**
@@ -0,0 +1,5 @@
# Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
Please read the [full text](https://code.fb.com/codeofconduct/)
so that you can understand what actions will and will not be tolerated.
@@ -0,0 +1,34 @@
# Contributing to PyText
We want to make contributing to this project as easy and transparent as
possible.

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.

## Coding Style
We try to follow the PEP style guidelines and encourage you to as well.

## License
By contributing to PyText, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
30 LICENSE
@@ -0,0 +1,30 @@
BSD License

For PyText software

Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,59 @@
# Overview

[![CircleCI](https://circleci.com/gh/facebookresearch/pytext.svg?style=svg&circle-token=2e0e0cb6dc686b646df887c2e0f07a8429712243)](https://circleci.com/gh/facebookresearch/pytext)

PyText is a deep-learning based NLP modeling framework built on PyTorch. PyText addresses the often-conflicting requirements of enabling rapid experimentation and of serving models at scale. It achieves this by providing simple and extensible interfaces and abstractions for model components, and by using PyTorch’s capabilities of exporting models for inference via the optimized Caffe2 execution engine. We are using PyText in Facebook to iterate quickly on new modeling ideas and then seamlessly ship them at scale.

**Core PyText features:**
- Production ready models for various NLP/NLU tasks:
- Text classifiers
- [Yoon Kim (2014): Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882)
- [Lin et al. (2017): A Structured Self-attentive Sentence Embedding](https://arxiv.org/abs/1703.03130)
- Sequence taggers
- [Lample et al. (2016): Neural Architectures for Named Entity Recognition](https://www.aclweb.org/anthology/N16-1030)
- Joint intent-slot model
- [Zhang et al. (2016): A Joint Model of Intent Determination and Slot Filling for Spoken Language Understanding](https://www.ijcai.org/Proceedings/16/Papers/425.pdf)
- Contextual intent-slot models
- Distributed-training support built on the new C10d backend in PyTorch 1.0
- Extensible components that allows easy creation of new models and tasks
- Reference implementation and a pretrained model for the paper: [Gupta et al. (2018): Semantic Parsing for Task Oriented Dialog using Hierarchical Representations](http://aclweb.org/anthology/D18-1300)
- Ensemble training support

# Installing PyText

*To get started on a Cloud VM, checkout [our guide](CLOUDS.md)*

We recommend using a virtualenv:

```
$ python3 -m virtualenv venv
$ source pytext/bin/activate
(venv) $ pip install pytext
```

Detailed instructions can be found in our [Documentation](https://pytext.readthedocs.io/installation.html)

# Train your first text classifier

For this first example, we'll train a CNN-based text-classifier that classifies text utterances, using the examples in `tests/data/train_data_tiny.tsv`.

```
(venv) $ pytext train < demo/configs/docnn.json
```

By default, the model is created in `/tmp/model.pt`

Now you can export your model as a caffe2 net:

```
(venv) $ pytext export < config.json
```

You can use the exported caffe2 model to predict the class of raw utterances like this:

```
(venv) $ pytext --config-file config.json predict <<< '{"raw_text": "create an alarm for 1:30 pm"}'
```

# License
PyText is BSD-licensed, as found in the LICENSE file.
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
VENV_NAME=${1:-venv}

if [ ! -d "$VENV_NAME" ]
then
python3 -m venv "$VENV_NAME"
fi
# shellcheck source=/dev/null
source "$VENV_NAME/bin/activate"
@@ -0,0 +1,14 @@
@ECHO OFF
::Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
::Use venv name if passed, otherwise default
IF "%1"=="" (
SET "_PYTEXT_ENV_NAME_=venv"
) ELSE (
SET "_PYTEXT_ENV_NAME_=%1"
)

IF NOT EXIST %_PYTEXT_ENV_NAME_% (
python -m venv %_PYTEXT_ENV_NAME_%
)

call %_PYTEXT_ENV_NAME_%\Scripts\activate.bat
@@ -0,0 +1,83 @@
{
"config": {
"task": {
"JointTextTask": {
"model": {
"representation": {
"BiLSTMDocSlotAttention": {
"lstm": {
"dropout": 0.5,
"lstm_dim": 366,
"num_layers": 2,
"bidirectional": true
},
"pooling": {
"SelfAttention": {
"attn_dimension": 128
}
}
}
},
"output_layer": {
"doc_output": {
"loss": {
"CrossEntropyLoss": {}
}
},
"word_output": {
"CRFOutputLayer": {}
}
}
},
"features": {
"word_feat": {
"embed_dim": 100,
"embedding_init_strategy": "zero",
"export_input_names": [
"tokens_vals"
],
"pretrained_embeddings_path": "demo/atis_joint_model/glove.6B.100d.txt",
"vocab_from_train_data": true,
"vocab_from_all_data": false,
"lowercase_tokens": true
}
},
"optimizer": {
"type": "adam",
"lr": "0.001",
"weight_decay": 0
},
"trainer": {
"epochs": 30
},
"featurizer": {
"SimpleFeaturizer": {}
},
"labels": [
{
"DocLabelConfig": {}
},
{
"WordLabelConfig": {}
}
],
"data_handler": {
"columns_to_read": [
"doc_label",
"word_label",
"text"
],
"train_batch_size": 86,
"eval_batch_size": 128,
"test_batch_size": 128,
"train_path": "demo/atis_joint_model/atis.processed.train.csv",
"eval_path": "demo/atis_joint_model/atis.processed.val.csv",
"test_path": "demo/atis_joint_model/atis.processed.test.csv"
},
"exporter": {}
}
},
"save_snapshot_path": "/tmp/atis_joint_model.pt",
"export_caffe2_path": "/tmp/atis_joint_model.c2"
}
}
Oops, something went wrong.

0 comments on commit a64370c

Please sign in to comment.