diff --git a/fastNLP/__init__.py b/fastNLP/__init__.py index 9873be72..bb9dfb4a 100644 --- a/fastNLP/__init__.py +++ b/fastNLP/__init__.py @@ -33,7 +33,6 @@ __all__ = [ "EngChar2DPadder", "AccuracyMetric", - "BMESF1PreRecMetric", "SpanFPreRecMetric", "SQuADMetric", diff --git a/fastNLP/core/callback.py b/fastNLP/core/callback.py index ba73f101..76a9e2e2 100644 --- a/fastNLP/core/callback.py +++ b/fastNLP/core/callback.py @@ -1,5 +1,10 @@ r""" -callback模块实现了 fastNLP 中的许多 callback 类,用于增强 :class:`~fastNLP.Trainer` 类, +callback模块实现了 fastNLP 中的许多 callback 类,用于增强 :class:`~fastNLP.Trainer` 类。 + +虽然Trainer本身已经集成了一些功能,但仍然不足以囊括训练过程中可能需要到的功能, +比如负采样,learning rate decay, Early Stop等。 +为了解决这个问题fastNLP引入了callback的机制,Callback 是一种在Trainer训练过程中特定阶段会运行的函数集合。 +关于Trainer的详细文档,请参见 :doc:`trainer 模块` 我们将 :meth:`~fastNLP.Train.train` 这个函数内部分为以下的阶段,在对应阶段会触发相应的调用:: @@ -26,8 +31,6 @@ callback模块实现了 fastNLP 中的许多 callback 类,用于增强 :class: callback.on_train_end() # 训练结束 callback.on_exception() # 这是一个特殊的步骤,在训练过程中遭遇exception会跳转到这里 -关于Trainer的详细文档,请参见 :doc:`trainer 模块` - 如下面的例子所示,我们可以使用内置的 callback 类,或者继承 :class:`~fastNLP.core.callback.Callback` 定义自己的 callback 类:: diff --git a/fastNLP/core/const.py b/fastNLP/core/const.py index f3022db2..89ff51a2 100644 --- a/fastNLP/core/const.py +++ b/fastNLP/core/const.py @@ -1,5 +1,10 @@ class Const: - """fastNLP中field命名常量。 + """ + fastNLP中field命名常量。 + + .. todo:: + 把下面这段改成表格 + 具体列表:: INPUT 模型的序列输入 words(复数words1, words2) diff --git a/fastNLP/models/__init__.py b/fastNLP/models/__init__.py index f0d84b1c..bad96cf9 100644 --- a/fastNLP/models/__init__.py +++ b/fastNLP/models/__init__.py @@ -3,6 +3,7 @@ TODO 详细介绍的表格,与主页相对应 """ +__all__ = ["CNNText", "SeqLabeling", "ESIM", "STSeqLabel", "AdvSeqLabel", "STNLICls", "STSeqCls"] from .base_model import BaseModel from .bert import BertForMultipleChoice, BertForQuestionAnswering, BertForSequenceClassification, \ BertForTokenClassification