Skip to content

Commit

Permalink
update sphinx files and fix some docs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
angus-lherrou committed Jul 6, 2023
1 parent 8d24c1c commit 0c5b7d4
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 3 deletions.
Empty file modified build_doc_source.sh
100644 → 100755
Empty file.
6 changes: 6 additions & 0 deletions docs/cnlpt.api.hier_rest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cnlpt.api.hier\_rest module
===========================

.. automodule:: cnlpt.api.hier_rest
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/cnlpt.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Submodules
cnlpt.api.cnlp_rest
cnlpt.api.dtr_rest
cnlpt.api.event_rest
cnlpt.api.hier_rest
cnlpt.api.negation_rest
cnlpt.api.temporal_rest
cnlpt.api.timex_rest
Expand Down
6 changes: 6 additions & 0 deletions docs/cnlpt.cnlp_args.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cnlpt.cnlp\_args module
=======================

.. automodule:: cnlpt.cnlp_args
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/cnlpt.cnlp_metrics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cnlpt.cnlp\_metrics module
==========================

.. automodule:: cnlpt.cnlp_metrics
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/cnlpt.cnlp_predict.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cnlpt.cnlp\_predict module
==========================

.. automodule:: cnlpt.cnlp_predict
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/cnlpt.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Submodules
:maxdepth: 4

cnlpt.data.preprocess_i2b2_2008
cnlpt.data.transform_prot
cnlpt.data.transform_uci_drug

Module contents
Expand Down
6 changes: 6 additions & 0 deletions docs/cnlpt.data.transform_prot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cnlpt.data.transform\_prot module
=================================

.. automodule:: cnlpt.data.transform_prot
:members:
:show-inheritance:
3 changes: 3 additions & 0 deletions docs/cnlpt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Submodules
cnlpt.BaselineModels
cnlpt.CnlpModelForClassification
cnlpt.HierarchicalTransformer
cnlpt.cnlp_args
cnlpt.cnlp_data
cnlpt.cnlp_metrics
cnlpt.cnlp_predict
cnlpt.cnlp_processors
cnlpt.thyme_eval
cnlpt.train_system
Expand Down
Binary file modified docs/transformer_objects.inv
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/transformer_objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ transformers.data.processors.utils.InputExample py:class 1 main_classes/processo
transformers.tokenization_utils.PreTrainedTokenizer py:class 1 main_classes/tokenizer#transformers.PreTrainedTokenizer -
transformers.PretrainedConfig py:class 1 main_classes/configuration#$ -
transformers.AutoConfig py:class 1 model_doc/auto#$ -
transformers.BatchEncoding py:class 1 main_classes/tokenizer#$ -
transformers.tokenization_utils_base.BatchEncoding py:class 1 main_classes/tokenizer#transformers.BatchEncoding -
5 changes: 2 additions & 3 deletions src/cnlpt/cnlp_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import torch
from torch.utils.data.dataset import Dataset
from transformers import BatchEncoding, InputExample
# from transformers.data.processors.utils import DataProcessor, InputExample
from transformers.tokenization_utils import PreTrainedTokenizer
from datasets import Features
from dataclasses import dataclass, field, asdict, astuple
Expand Down Expand Up @@ -121,7 +120,7 @@ def cnlp_convert_features_to_hierarchical(
:param pad_id: the tokenizer's ID representing the PAD token
:param insert_empty_chunk_at_beginning: whether to insert an
empty chunk at the beginning of the instance
:return: an instance of `BatchEncoding` containing the chunked instance
:return: an instance of :class:`transformers.BatchEncoding` containing the chunked instance
"""

for ind in range(len(features['input_ids'])):
Expand Down Expand Up @@ -740,7 +739,7 @@ def _reconcile_labels_lists(self, processor):
new_labels = set(labels)
old_labels = set(self.tasks_to_labels[task])
if new_labels.isdisjoint(old_labels):
raise Exception("The same task name has disjoint sets of labels in different dataset: %s vs. %s" % (str(str(old_labels), str(new_labels))))
raise Exception("The same task name has disjoint sets of labels in different dataset: %s vs. %s" % (str(old_labels), str(new_labels)))
elif new_labels != old_labels:
logger.warn("Two different datasets have the same task name but not completely equal label lists: %s vs. %s. We will merge them." (str(old_labels), str(new_labels)))
self.tasks_to_labels[task] = old_labels.union(new_labels)
Expand Down

0 comments on commit 0c5b7d4

Please sign in to comment.