Giter Club home page Giter Club logo

entity_extractor_by_pointer's Introduction

Nice to see you.👋

stanleylsx's GitHub stats

entity_extractor_by_pointer's People

Contributors

stanleylsx avatar tosemml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

entity_extractor_by_pointer's Issues

p,r,f1都是0

你好,我在使用gp和bp方式进行英文实体识别,训练时p,r,f1都是0,训练数据是conllu2003,预训练模型是bert-base-uncased,训练数据的样式如图所示
微信截图_20231208150646

验证时出错

def extract_entities(configs, tokenizer, text, model, device):
"""
从验证集中预测到相关实体
"""
predict_results = {}
encode_results = tokenizer(text, padding='max_length')
input_ids = encode_results.get('input_ids')
token = tokenizer.convert_ids_to_tokens(input_ids)
mapping = rematch(text, token)
token_ids = torch.unsqueeze(torch.LongTensor(input_ids), 0) .to(device)
attention_mask = torch.unsqueeze(torch.LongTensor(encode_results.get('attention_mask')), 0).to(device)
model_outputs = model(token_ids, attention_mask).detach().to('cpu')
decision_threshold = float(configs.decision_threshold)
for model_output in model_outputs:
start = np.where(model_output[:, :, 0] > decision_threshold)
end = np.where(model_output[:, :, 1] > decision_threshold)
for _start, predicate1 in zip(*start):
for _end, predicate2 in zip(*end):
if _start <= _end and predicate1 == predicate2:
if len(mapping[_start]) > 0 and len(mapping[_end]) > 0:
start_in_text = mapping[_start][0]
end_in_text = mapping[_end][-1]
entity_text = text[start_in_text: end_in_text + 1]
predict_results.setdefault(predicate1, set()).add(entity_text)
break
return predict_results

to('cpu')
验证时 RuntimeError: CUDA error: device-side assert triggered

start/end标注方式

你好,请问一下start/end这种标注方式,相对于传统的CRF有什么优点呢?

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.