Git Product home page Git Product logo

Comments (6)

taishan1994 avatar taishan1994 commented on June 12, 2024

在训练并将BERT+CRF模型转换为ONNX模型时,我们应该使用哪个CRF文件?根据README,我们必须使用这个文件pytext-crf,那么我们是否必须对其进行一些修改才能使其发挥作用?

convert_onnx下已经有修改好的模型了,直接设置convert_onnx.py里面的相关参数配置运行就可以了。

from pytorch_bert_bilstm_crf_ner.

colabpp avatar colabpp commented on June 12, 2024

谢谢你的快速回复。我们应该使用哪种CRF代码将BERT-CRF模型转换为ONNX,是pytorch-crf还是README中提到的layers/CRF.pypytext/crf中提供的代码?
原本的pytorch-crf不能转换为onnx,这里使用了here

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 12, 2024

谢谢你的快速回复。我们应该使用哪种CRF代码将BERT-CRF模型转换为ONNX,是pytorch-crf还是README中提到的layers/CRF.pypytext/crf中提供的代码? 原本的pytorch-crf不能转换为onnx,这里使用了here

convert_onnx用的其下面的convert_onnx/bert_ner_model_onnx.py里面的模型,里面使用的是from layers.CRF import CRF

from pytorch_bert_bilstm_crf_ner.

colabpp avatar colabpp commented on June 12, 2024

我已经开始工作了,pytorch的版本有问题。谢谢你的工作和支持。你是伟大的!

from pytorch_bert_bilstm_crf_ner.

libaiCool avatar libaiCool commented on June 12, 2024

你好,convert_onnx.py导出的onnx模型无法支持多条数据并行推理。报错如下:
best_tags_list[:, i + 1] = history[i, :, last_idx].squeeze(1)
RuntimeError: shape mismatch: value tensor of shape [2, 2] cannot be broadcast to indexing result of shape [2]
请问该如何处理

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 12, 2024

因为CRF的原因,不能进行batch推理

from pytorch_bert_bilstm_crf_ner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.