Skip to content
16 changes: 8 additions & 8 deletions applications/text_classification/hierarchical/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ python analysis/evaluate.py --device "gpu" --max_seq_length 128 --batch_size 32
预测错误的样本保存在bad_case.txt文件中:

```text
Text Label Prediction
据猛龙随队记者JoshLewenberg报道,消息人士透露,猛龙已将前锋萨加巴-科纳特裁掉。此前他与猛龙签下了一份Exhibit10合同。在被裁掉后,科纳特下赛季大概率将前往猛龙的发展联盟球队效力。 组织关系,组织关系##加盟,组织关系##裁员 组织关系,组织关系##解雇
冠军射手被裁掉,欲加入湖人队,但湖人却无意,冠军射手何去何从 组织关系,组织关系##裁员 组织关系,组织关系##解雇
6月7日报道,IBM将裁员超过1000人。IBM周四确认,将裁减一千多人。据知情人士称,此次裁员将影响到约1700名员工,约占IBM全球逾34万员工中的0.5%。IBM股价今年累计上涨16%,但该公司4月发布的财报显示,一季度营收下降5%,低于市场预期。 组织关系,组织关系##裁员 组织关系,组织关系##裁员,财经/交易
有多名魅族员工表示,从6月份开始,魅族开始了新一轮裁员,重点裁员区域是营销和线下。裁员占比超过30%,剩余员工将不过千余人,魅族的知名工程师,爱讲真话的洪汉生已经从钉钉里退出了,外界传言说他去了OPPO。 组织关系,组织关系##退出,组织关系##裁员 组织关系,组织关系##裁员
Text Label Prediction
据猛龙随队记者JoshLewenberg报道,消息人士透露,猛龙已将前锋萨加巴-科纳特裁掉。此前他与猛龙签下了一份Exhibit10合同。在被裁掉后,科纳特下赛季大概率将前往猛龙的发展联盟球队效力。 组织关系,组织关系##加盟,组织关系##裁员 组织关系,组织关系##解雇
冠军射手被裁掉,欲加入湖人队,但湖人却无意,冠军射手何去何从 组织关系,组织关系##裁员 组织关系,组织关系##解雇
6月7日报道,IBM将裁员超过1000人。IBM周四确认,将裁减一千多人。据知情人士称,此次裁员将影响到约1700名员工,约占IBM全球逾34万员工中的0.5%。IBM股价今年累计上涨16%,但该公司4月发布的财报显示,一季度营收下降5%,低于市场预期。 组织关系,组织关系##裁员 组织关系,组织关系##裁员,财经/交易
有多名魅族员工表示,从6月份开始,魅族开始了新一轮裁员,重点裁员区域是营销和线下。裁员占比超过30%,剩余员工将不过千余人,魅族的知名工程师,爱讲真话的洪汉生已经从钉钉里退出了,外界传言说他去了OPPO。 组织关系,组织关系##退出,组织关系##裁员 组织关系,组织关系##裁员
...
```

Expand All @@ -301,9 +301,9 @@ text: 据猛龙随队记者JoshLewenberg报道,消息人士透露,猛龙已
predict label: 组织关系,组织关系##解雇
label: 组织关系,组织关系##加盟,组织关系##裁员
examples with positive influence
support1 text: 尼克斯官方今日宣布,他们已经裁掉了前锋扎克-欧文,后者昨日才与尼克斯签约。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.99357
support2 text: 活塞官方今日宣布,他们已经签下了克雷格-斯沃德,并且裁掉了托德-威瑟斯。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.98344
support3 text: 孟菲斯灰熊今年宣布,球队已经签下后卫达斯蒂-汉纳斯(DustyHannahs,版头图)并裁掉马特-穆尼。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.98219
support1 text: 尼克斯官方今日宣布,他们已经裁掉了前锋扎克-欧文,后者昨日才与尼克斯签约。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.99357
support2 text: 活塞官方今日宣布,他们已经签下了克雷格-斯沃德,并且裁掉了托德-威瑟斯。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.98344
support3 text: 孟菲斯灰熊今年宣布,球队已经签下后卫达斯蒂-汉纳斯(DustyHannahs,版头图)并裁掉马特-穆尼。 label: 组织关系,组织关系##加盟,组织关系##解雇 score: 0.98219
...
```

Expand Down
8 changes: 4 additions & 4 deletions applications/text_classification/multi_label/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ python analysis/evaluate.py --device "gpu" --max_seq_length 128 --batch_size 32
预测错误的样本保存在bad_case.txt文件中:

```text
Text Label Prediction
Text Label Prediction
2014年,王X以其与肖X协议离婚时未分割该套楼房的首付款为由,起诉至法院,要求分得楼房的首付款15万元。 不动产分割,有夫妻共同财产 不动产分割
但原、被告对已建立起的夫妻感情不够珍惜,因琐事即发生吵闹并最终分居,对夫妻感情造成了严重的影响,现原、被告已分居六年有余,且经人民法院判决不准离婚后仍未和好,夫妻感情确已破裂,依法应准予原、被告离婚。 二次起诉离婚,准予离婚,婚后分居,法定离婚 婚后分居,准予离婚
婚后生有一女,取名彭某乙,已11岁,现已由被告从铁炉白族乡中心小学转入走马镇李桥小学读书。 婚后有子女 婚后有子女,限制行为能力子女抚养
Expand All @@ -295,9 +295,9 @@ text: 2015年2月23日,被告将原告赶出家门,原告居住于娘家待
predict label: 婚后分居
label: 不履行家庭义务,婚后分居
examples with positive influence
support1 text: 2014年中秋节原告回了娘家,原、被告分居至今。 label: 婚后分居 score: 0.99942
support2 text: 原告于2013年8月13日离开被告家,分居至今。 label: 婚后分居 score: 0.99916
support3 text: 2014年4月,被告外出务工,双方分居至今。 label: 婚后分居 score: 0.99902
support1 text: 2014年中秋节原告回了娘家,原、被告分居至今。 label: 婚后分居 score: 0.99942
support2 text: 原告于2013年8月13日离开被告家,分居至今。 label: 婚后分居 score: 0.99916
support3 text: 2014年4月,被告外出务工,双方分居至今。 label: 婚后分居 score: 0.99902
...
```

Expand Down
4 changes: 2 additions & 2 deletions examples/language_model/glm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
from paddle import Tensor
from paddle.optimizer.lr import LambdaDecay

from paddlenlp.trainer import Trainer
from paddlenlp.transformers.generation_utils import (
from paddlenlp.generation.logits_process import (
LogitsProcessorList,
MinLengthLogitsProcessor,
NoRepeatNGramLogitsProcessor,
)
from paddlenlp.trainer import Trainer


class GLMTrainer(Trainer):
Expand Down
2 changes: 1 addition & 1 deletion examples/language_model/gpt-3/dygraph/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
from paddle.nn.layer.transformer import _convert_param_attr_to_list

import paddlenlp
from paddlenlp.generation.logits_process import LogitsProcessorList
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transformers import PretrainedModel, register_base_model
from paddlenlp.transformers.generation_utils import LogitsProcessorList
from paddlenlp.transformers.model_outputs import (
CausalLMOutputWithCrossAttentions,
SequenceClassifierOutputWithPast,
Expand Down
1 change: 1 addition & 0 deletions examples/language_model/gpt-3/static/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import argparse

import paddle

from paddlenlp.utils.log import logger


Expand Down
27 changes: 17 additions & 10 deletions examples/text_classification/ernie_doc/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
import os
import paddle
from functools import partial

import numpy as np
from paddlenlp.utils.env import PPNLP_HOME
from paddlenlp.utils.log import logger
from paddlenlp.taskflow.utils import dygraph_mode_guard
from modeling import ErnieDocForSequenceClassification
from paddlenlp.transformers import ErnieDocTokenizer, ErnieDocBPETokenizer
from paddlenlp.datasets import load_dataset
from data import ClassifierIterator, ImdbTextPreprocessor, HYPTextPreprocessor, to_json_file
import paddle
import paddle.nn as nn
from data import (
ClassifierIterator,
HYPTextPreprocessor,
ImdbTextPreprocessor,
to_json_file,
)
from modeling import ErnieDocForSequenceClassification
from train import init_memory
from functools import partial
import argparse

from paddlenlp.datasets import load_dataset
from paddlenlp.taskflow.utils import dygraph_mode_guard
from paddlenlp.transformers import ErnieDocBPETokenizer, ErnieDocTokenizer
from paddlenlp.utils.env import PPNLP_HOME
from paddlenlp.utils.log import logger

# yapf: disable
parser = argparse.ArgumentParser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, unicode_literals, division
from __future__ import division, print_function, unicode_literals

import codecs
import os
Expand All @@ -28,6 +28,7 @@
from ConfigParser import ConfigParser

import logging

from pyrouge.utils import log
from pyrouge.utils.file_utils import verify_dir

Expand Down Expand Up @@ -640,6 +641,7 @@ def __get_config_path(self):

if __name__ == "__main__":
import argparse

from utils.argparsers import rouge_path_parser

parser = argparse.ArgumentParser(parents=[rouge_path_parser])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, unicode_literals, division
from __future__ import division, print_function, unicode_literals

import codecs
import logging
Expand Down Expand Up @@ -640,6 +640,7 @@ def __get_config_path(self):

if __name__ == "__main__":
import argparse

from utils.argparsers import rouge_path_parser

parser = argparse.ArgumentParser(parents=[rouge_path_parser])
Expand Down
1 change: 1 addition & 0 deletions paddlenlp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
datasets,
embeddings,
experimental,
generation,
layers,
losses,
metrics,
Expand Down
13 changes: 13 additions & 0 deletions paddlenlp/generation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading