Coder Social home page Coder Social logo

Comments (16)

taishan1994 avatar taishan1994 commented on June 4, 2024

你是怎么运行的,加载的模型是哪个

from pytorch_bert_bilstm_crf_ner.

SkylerMa avatar SkylerMa commented on June 4, 2024

你是怎么运行的,加载的模型是哪个

我是在pycharm里打开工程文件夹,然后在命令行输入了你给的这个运行命令,lstm和crf都设置的true
预训练模型的话就用的bert base chinese,放在了新建的同级目录model_hub/bert-base-chinese/下
同时也下载了百度网盘的这四个模型文件,放在了checkpoints下面

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 4, 2024

我加你qq吧,你说下。

from pytorch_bert_bilstm_crf_ner.

SkylerMa avatar SkylerMa commented on June 4, 2024

我加你qq吧,你说下。

2446642294

from pytorch_bert_bilstm_crf_ner.

Juliaququ avatar Juliaququ commented on June 4, 2024
           [--eval_batch_size EVAL_BATCH_SIZE] [--swa_start SWA_START] [--train_epochs TRAIN_EPOCHS] [--dropout_prob DROPOUT_PROB] [--lr LR] [--other_lr OTHER_LR] [--crf_lr CRF_LR]
           [--max_grad_norm MAX_GRAD_NORM] [--warmup_proportion WARMUP_PROPORTION] [--weight_decay WEIGHT_DECAY] [--adam_epsilon ADAM_EPSILON] [--train_batch_size TRAIN_BATCH_SIZE] [--use_lstm USE_LSTM]
           [--lstm_hidden LSTM_HIDDEN] [--num_layers NUM_LAYERS] [--dropout DROPOUT] [--use_crf USE_CRF]

main.py: error: unrecognized arguments:
./main.sh: 行 2: --bert_dir: 未找到命令
./main.sh: 行 3: --data_dir: 未找到命令
./main.sh: 行 4: --log_dir: 未找到命令
./main.sh: 行 5: --output_dir: 未找到命令
./main.sh: 行 6: --num_tags: 未找到命令
./main.sh: 行 7: --seed: 未找到命令
./main.sh: 行 8: --gpu_ids: 未找到命令
./main.sh: 行 9: --max_seq_len: 未找到命令
./main.sh: 行 10: --lr: 未找到命令
./main.sh: 行 11: --crf_lr: 未找到命令
./main.sh: 行 12: --other_lr: 未找到命令
./main.sh: 行 13: --train_batch_size: 未找到命令
./main.sh: 行 14: --train_epochs: 未找到命令
./main.sh: 行 15: --eval_batch_size: 未找到命令
./main.sh: 行 16: --max_grad_norm: 未找到命令
./main.sh: 行 17: --warmup_proportion: 未找到命令
./main.sh: 行 18: --adam_epsilon: 未找到命令
./main.sh: 行 19: --weight_decay: 未找到命令
./main.sh: 行 20: --lstm_hidden: 未找到命令
./main.sh: 行 21: --num_layers: 未找到命令
./main.sh: 行 22: --use_lstm: 未找到命令
./main.sh: 行 23: --use_crf: 未找到命令
./main.sh: 行 24: --dropout_prob: 未找到命令
./main.sh: 行 25: --dropout: 未找到命令
请问这是什么情况呢 运行main.sh跑不起来

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 4, 2024
           [--eval_batch_size EVAL_BATCH_SIZE] [--swa_start SWA_START] [--train_epochs TRAIN_EPOCHS] [--dropout_prob DROPOUT_PROB] [--lr LR] [--other_lr OTHER_LR] [--crf_lr CRF_LR]
           [--max_grad_norm MAX_GRAD_NORM] [--warmup_proportion WARMUP_PROPORTION] [--weight_decay WEIGHT_DECAY] [--adam_epsilon ADAM_EPSILON] [--train_batch_size TRAIN_BATCH_SIZE] [--use_lstm USE_LSTM]
           [--lstm_hidden LSTM_HIDDEN] [--num_layers NUM_LAYERS] [--dropout DROPOUT] [--use_crf USE_CRF]

main.py: error: unrecognized arguments:
./main.sh: 行 2: --bert_dir: 未找到命令
./main.sh: 行 3: --data_dir: 未找到命令
./main.sh: 行 4: --log_dir: 未找到命令
./main.sh: 行 5: --output_dir: 未找到命令
./main.sh: 行 6: --num_tags: 未找到命令
./main.sh: 行 7: --seed: 未找到命令
./main.sh: 行 8: --gpu_ids: 未找到命令
./main.sh: 行 9: --max_seq_len: 未找到命令
./main.sh: 行 10: --lr: 未找到命令
./main.sh: 行 11: --crf_lr: 未找到命令
./main.sh: 行 12: --other_lr: 未找到命令
./main.sh: 行 13: --train_batch_size: 未找到命令
./main.sh: 行 14: --train_epochs: 未找到命令
./main.sh: 行 15: --eval_batch_size: 未找到命令
./main.sh: 行 16: --max_grad_norm: 未找到命令
./main.sh: 行 17: --warmup_proportion: 未找到命令
./main.sh: 行 18: --adam_epsilon: 未找到命令
./main.sh: 行 19: --weight_decay: 未找到命令
./main.sh: 行 20: --lstm_hidden: 未找到命令
./main.sh: 行 21: --num_layers: 未找到命令
./main.sh: 行 22: --use_lstm: 未找到命令
./main.sh: 行 23: --use_crf: 未找到命令
./main.sh: 行 24: --dropout_prob: 未找到命令
./main.sh: 行 25: --dropout: 未找到命令
请问这是什么情况呢 运行main.sh跑不起来

可能是windows和linux换行的问题,你去掉\,都在一行输入看看。

from pytorch_bert_bilstm_crf_ner.

Juliaququ avatar Juliaququ commented on June 4, 2024
           [--eval_batch_size EVAL_BATCH_SIZE] [--swa_start SWA_START] [--train_epochs TRAIN_EPOCHS] [--dropout_prob DROPOUT_PROB] [--lr LR] [--other_lr OTHER_LR] [--crf_lr CRF_LR]
           [--max_grad_norm MAX_GRAD_NORM] [--warmup_proportion WARMUP_PROPORTION] [--weight_decay WEIGHT_DECAY] [--adam_epsilon ADAM_EPSILON] [--train_batch_size TRAIN_BATCH_SIZE] [--use_lstm USE_LSTM]
           [--lstm_hidden LSTM_HIDDEN] [--num_layers NUM_LAYERS] [--dropout DROPOUT] [--use_crf USE_CRF]

main.py: error: unrecognized arguments:
./main.sh: 行 2: --bert_dir: 未找到命令
./main.sh: 行 3: --data_dir: 未找到命令
./main.sh: 行 4: --log_dir: 未找到命令
./main.sh: 行 5: --output_dir: 未找到命令
./main.sh: 行 6: --num_tags: 未找到命令
./main.sh: 行 7: --seed: 未找到命令
./main.sh: 行 8: --gpu_ids: 未找到命令
./main.sh: 行 9: --max_seq_len: 未找到命令
./main.sh: 行 10: --lr: 未找到命令
./main.sh: 行 11: --crf_lr: 未找到命令
./main.sh: 行 12: --other_lr: 未找到命令
./main.sh: 行 13: --train_batch_size: 未找到命令
./main.sh: 行 14: --train_epochs: 未找到命令
./main.sh: 行 15: --eval_batch_size: 未找到命令
./main.sh: 行 16: --max_grad_norm: 未找到命令
./main.sh: 行 17: --warmup_proportion: 未找到命令
./main.sh: 行 18: --adam_epsilon: 未找到命令
./main.sh: 行 19: --weight_decay: 未找到命令
./main.sh: 行 20: --lstm_hidden: 未找到命令
./main.sh: 行 21: --num_layers: 未找到命令
./main.sh: 行 22: --use_lstm: 未找到命令
./main.sh: 行 23: --use_crf: 未找到命令
./main.sh: 行 24: --dropout_prob: 未找到命令
./main.sh: 行 25: --dropout: 未找到命令
请问这是什么情况呢 运行main.sh跑不起来

可能是windows和linux换行的问题,你去掉\,都在一行输入看看。

okk 已经解决!另外需要去掉等号 感谢楼主!

from pytorch_bert_bilstm_crf_ner.

zhangyujie209 avatar zhangyujie209 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直报这个错

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直报这个错

把相关文件的路径换成绝对路径试试。同时要注意windows和linux的区别。

from pytorch_bert_bilstm_crf_ner.

zhangyujie209 avatar zhangyujie209 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直在报这个错

把相关文件的路径提示绝对路径聪明。同时要注意windows和linux的区别。

from pytorch_bert_bilstm_crf_ner.

zhangyujie209 avatar zhangyujie209 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直在报这个错

把相关文件的路径提示绝对路径聪明。同时要注意windows和linux的区别。

我是想自己训练一下模型,这个位置不应该是训练完保存模型的位置吗,现在checkpionts文件是空的,找不到是正常的,我在想为啥没有训练,

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直在报这个错

把相关文件的路径提示绝对路径聪明。同时要注意windows和linux的区别。

我是想自己训练一下模型,这个位置不应该是训练完保存模型的位置吗,现在checkpionts文件是空的,找不到是正常的,我在想为啥没有训练,

main.py里面有训练、验证、测试和预测的代码,有可能是被注释掉了,自己根据相关需要打开注释的代码就行了。

from pytorch_bert_bilstm_crf_ner.

zhangyujie209 avatar zhangyujie209 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直在报这个错

把相关文件的路径提示绝对路径聪明。同时要注意windows和linux的区别。

我是想自己训练一下模型,这个位置不应该是训练完保存模型的位置吗,现在checkpionts文件是空的,找不到是正常的,我在想为啥没有训练,

main.py里面有训练、验证、测试和预测的代码,有可能是被注释掉了,自己根据相关需要打开注释的代码就行了。

   bertForNer.train()

我把这个注释打开以后
RuntimeError: stack expects a non-empty TensorList
说我数据没有传进去

from pytorch_bert_bilstm_crf_ner.

zhangyujie209 avatar zhangyujie209 commented on June 4, 2024

``FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/bert_bilstm_crf/model.pt'
老哥我一直在报这个错

把相关文件的路径提示绝对路径聪明。同时要注意windows和linux的区别。

我是想自己训练一下模型,这个位置不应该是训练完保存模型的位置吗,现在checkpionts文件是空的,找不到是正常的,我在想为啥没有训练,

main.py里面有训练、验证、测试和预测的代码,有可能是被注释掉了,自己根据相关需要打开注释的代码就行了。

   bertForNer.train()

我把这个注释打开以后
RuntimeError: stack expects a non-empty TensorList
说我数据没有传进去

我在您公众号上给您发消息了,您看到回一下

from pytorch_bert_bilstm_crf_ner.

PeterLiuY avatar PeterLiuY commented on June 4, 2024

你好,我单独使用bert模型,没有加LSTM和CRF,在main.py中运行 bertForNer.predict(raw_text, model_path)
报出错误,RuntimeError: Boolean value of Tensor with more than one value is ambiguous
然后我定位到decodeUtils.py中的方法 bioes_decode(decode_tokens, raw_text, id2ent) 中的 if decode_tokens[index_] == 0: 这一行
传入的 decode_tokens 是一个张量,可以直接判断是否等于0吗?
不知道怎么解决了,希望博主能帮忙下

from pytorch_bert_bilstm_crf_ner.

taishan1994 avatar taishan1994 commented on June 4, 2024

你好,我单独使用bert模型,没有加LSTM和CRF,在main.py中运行 bertForNer.predict(raw_text, model_path) 报出错误,RuntimeError: Boolean value of Tensor with more than one value is ambiguous 然后我定位到decodeUtils.py中的方法 bioes_decode(decode_tokens, raw_text, id2ent) 中的 if decode_tokens[index_] == 0: 这一行 传入的 decode_tokens 是一个张量,可以直接判断是否等于0吗? 不知道怎么解决了,希望博主能帮忙下

decode_tokens应该是一个一维数组,比如[0,1,2,2,3,0,0],自己打印下看怎么转换成这样。

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.