Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • models
  • Issue
  • #4627

M
models
  • 项目概览

PaddlePaddle / models
大约 2 年 前同步成功

通知 232
Star 6828
Fork 2962
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 602
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 255
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
M
models
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 602
    • Issue 602
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 255
    • 合并请求 255
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 5月 14, 2020 by saxon_zh@saxon_zhGuest

调用动态图实现的Linear_chain_crf的问题

Created by: yaweisun

实现该接口的文件如下: https://github.com/PaddlePaddle/models/blob/develop/dygraph/lac/sequence_labeling.py 运行的环境是aistudio高级版,paddlepaddle 1.7.1, python 3.7 我调用的代码如下:

linear_chain_crf = Linear_chain_crf(
        param_attr=fluid.ParamAttr(
            name='linear_chain_crfw', learning_rate=LR),
        size=num_labels)
crf_cost = linear_chain_crf(emission, label=label, length=MAX_SEQLEN)

emission.shape和label.shape均为[16, 400, 5]。其中16是batch_size,400是序列最大长度,5是序列标注的类别数量。 执行之后报错,没有找到该接口对输入参数的具体要求,因而想咨询一下这是出现这个问题的原因。报错信息如下:

> ---------------------------------------EnforceNotMet                             Traceback (most recent call last)<ipython-input-36-85157a21fed9> in <module>
> ----> 1 linear_chain_crf(emission, label=label, length=128)
> /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in __call__(self, *inputs, **kwargs)
>     302             self._built = True
>     303 
> --> 304         outputs = self.forward(*inputs, **kwargs)
>     305         return outputs
>     306 
> ~/ernie/sequence_labeling.py in forward(self, input, label, length)
>     177                         },
>     178                         attrs={
> --> 179                             "is_test": self._is_test,
>     180                         })
>     181         return log_likelihood
> /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layer_object_helper.py in append_op(self, type, inputs, outputs, attrs, stop_gradient)
>      50             outputs=outputs,
>      51             attrs=attrs,
> ---> 52             stop_gradient=stop_gradient)
>      53 
>      54     def _multiple_input(self, inputs_in):
> /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py in append_op(self, *args, **kwargs)
>    2514                                        kwargs.get("outputs", {}), attrs
>    2515                                        if attrs else {},
> -> 2516                                        kwargs.get("stop_gradient", False))
>    2517         else:
>    2518             op_desc = self.desc.append_op()
> /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/tracer.py in trace_op(self, type, inputs, outputs, attrs, stop_gradient)
>      37         self.trace(type, inputs, outputs, attrs,
>      38                    framework._current_expected_place(), self._train_mode and
> ---> 39                    not stop_gradient)
>      40 
>      41     def train_mode(self):
> EnforceNotMet: 
> 
> --------------------------------------------
> C++ Call Stacks (More useful to developers):
> --------------------------------------------
> 0   std::string paddle::platform::GetTraceBackString<std::string>(std::string&&, char const*, int)
> 1   paddle::platform::EnforceNotMet::EnforceNotMet(paddle::platform::ErrorSummary const&, char const*, int)
> 
> ----------------------
> Error Message Summary:
> ----------------------
> Error: Python object is not type of St10shared_ptrIN6paddle10imperative7VarBaseEE at (/paddle/paddle/fluid/pybind/imperative.cc:158)
指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/models#4627
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7