03 2021 档案
摘要:#读取ontonote4并转换格式 f=open("./data/ontonote4/train.char.bmes","r+",encoding="utf-8") sentences = [] sentence = [] label_set=set() cnt_line=0 for line in
阅读全文
摘要:将BMES标记的NER语料库转换为BIO标记的语料库 读取 f = open("./data/msra/dev.char.bmes",encoding='utf-8') sentences = [] sentence = [] label_set=set() cnt_line=0 for line
阅读全文
摘要:解决RuntimeError: CUDA error: out of memory 跑代码时出现这个错误,输入以下命令 $ nvidia-smi -l 原来是卡0内存爆了,于是指定相对空闲的2卡 CUDA_VISIBLE_DEVICES=2 python my_script.py 可以正常运行
阅读全文
摘要:没有告诉系统bert的具体路径,在代码中加入 import sys sys.path.append("E:/NER/bert") 解决之
阅读全文
摘要:#!/usr/bin/env bash export MAX_LENGTH=128 export BERT_MODEL=bert-base-cased export BATCH_SIZE=32 export NUM_EPOCHS=5 export SEED=1 export OUTPUT_DIR_N
阅读全文
摘要:def readfile(filename): ''' read file return format : [ ['EU', 'B-ORG'], ['rejects', 'O'], ['German', 'B-MISC'], ['call', 'O'], ['to', 'O'], ['boycott
阅读全文