Comments (18)
Hey @HqWu-HITCS, thanks for experimenting with OpenKiwi.
I managed to reproduce your error.
The problem is that we hadn't considered the possibility of training the Estimator model solely for sentence level. A fix has been proposed in #19 and should be merged shortly.
from openkiwi.
This has now been merged. I will close the issue.
Feel free to re-open if you have any issues with the newest master.
from openkiwi.
This has now been merged. I will close the issue.
Feel free to re-open if you have any issues with the newest master.
Thank you very much~
from openkiwi.
@HqWu-HITCS 你好!你之前提出的这个问题解决了吗?我现在训练estimator,也遇到了你同样的问题,TypeError: 'NoneType' object is not subscriptable,一直无法进行下去。。。
from openkiwi.
@HqWu-HITCS 你好!你之前提出的这个问题解决了吗?我现在训练estimator,也遇到了你同样的问题,TypeError: 'NoneType' object is not subscriptable,一直无法进行下去。。。
作者后来修改了这个bug,更新代码后就好使了。
from openkiwi.
@HqWu-HITCS 你好!你之前提出的这个问题解决了吗?我现在训练estimator,也遇到了你同样的问题,TypeError: 'NoneType' object is not subscriptable,一直无法进行下去。。。
作者后来修改了这个bug,更新代码后就好使了。
我用了最新版本的repo, 无论WMT的官方语料还是CWMT的汉英语料,训练句子级别的estimator总是不行。你用的什么语种的语料呢?方便分享一份你的config.yaml吗?非常感谢!
from openkiwi.
@HqWu-HITCS 你好!你之前提出的这个问题解决了吗?我现在训练estimator,也遇到了你同样的问题,TypeError: 'NoneType' object is not subscriptable,一直无法进行下去。。。
作者后来修改了这个bug,更新代码后就好使了。
我用了最新版本的repo, 无论WMT的官方语料还是CWMT的汉英语料,训练句子级别的estimator总是不行。你用的什么语种的语料呢?方便分享一份你的config.yaml吗?非常感谢!
WMT和CWMT我都用过,都没问题,以下是我的config
model: estimator
output-dir: runs/estimator_zhen_256
hidden-est: 256
rnn-layers-est: 2
dropout-est: 0.0
mlp-est: True
token-level: True
sentence-level: True
sentence-ll: False
binary-level: False
predict-target: False
predict-source: False
predict-gaps: false
gpu-id: 1
epochs: 15
checkpoint-validation-steps: 0
checkpoint-save: true
checkpoint-keep-only-best: 3
checkpoint-early-stop-patience: 0
log-interval: 100
learning-rate: 2e-3
train-batch-size: 32
valid-batch-size: 32
load-pred-target: runs/predictor/step_310000/model.torch
source-max-length: 60
source-min-length: 1
target-max-length: 60
target-min-length: 1
train-source: /home/.../QE/.../data/qe/train.src
train-target: /home/.../QE/.../data/qe/train.trg
train-pe: /home/.../QE/.../data/qe/train.pe
train-sentence-scores: /home/.../QE/.../data/qe/train.hter
valid-source: /home/.../QE/.../data/qe/dev.src
valid-target: /home/.../QE/.../data/qe/dev.trg
valid-pe: /home/.../QE/.../data/qe/dev.pe
valid-sentence-scores: /home/.../QE/.../data/qe/dev.hter
from openkiwi.
@HqWu-HITCS 谢谢~ 我新建了一个虚拟环境,重装了openkiwi,用你的config重新跑数据,还是卡在train_estimator了。错误依然还是NoneType object is not subscriptable……
from openkiwi.
@HqWu-HITCS 不好意思,再次打扰了~ 请问你后来用最新的repo把整个QE的流程都跑通了是吗?你是用哪种方式跑的?是命令行方式kiwi train --config=train_estimator.yaml
还是在py文件里调用的呢?
`import kiwi
estimator_config = 'train_estimator.yaml'
kiwi.train(estimator_config)`
我用了两种方式,始终都跑不通……
from openkiwi.
from openkiwi.
你好 @HqWu-HITCS ,我也正在跑Predictor-Estimator
模型,训练部分没有问题,但是到了预测的那一步,发生了错误:
2019-04-22 07:19:37.521 [kiwi.lib.predict setup:159] {'batch_size': 64,
'config': 'experiments_sl/predict_estimator.yaml',
'debug': False,
'experiment_name': 'EN-ZH Pretrain Predictor',
'gpu_id': None,
'load_data': None,
'load_model': 'runs/0/464dc10bfc174ac79ca082eae0dea352/best_model.torch',
'load_vocab': None,
'log_interval': 100,
'mlflow_always_log_artifacts': False,
'mlflow_tracking_uri': 'mlruns/',
'model': 'estimator',
'output_dir': 'predictions/predest/ccmt/en_zh',
'quiet': False,
'run_uuid': None,
'save_config': None,
'save_data': None,
'seed': 42}
2019-04-22 07:19:37.521 [kiwi.lib.predict setup:160] Local output directory is: predictions/predest/ccmt/en_zh
2019-04-22 07:19:37.521 [kiwi.lib.predict run:100] Predict with the PredEst (Predictor-Estimator) model
Traceback (most recent call last):
File "/home2/zyl/anaconda3/envs/openkiwi/bin/kiwi", line 10, in
sys.exit(main())
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/main.py", line 22, in main
return kiwi.cli.main.cli()
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/cli/main.py", line 73, in cli
predict.main(extra_args)
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/cli/pipelines/predict.py", line 56, in main
predict.predict_from_options(options)
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/lib/predict.py", line 54, in predict_from_options
run(options.model_api, output_dir, options.pipeline, options.model)
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/lib/predict.py", line 113, in run
model = Model.create_from_file(pipeline_opts.load_model)
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/models/model.py", line 214, in create_from_file
model = Model.subclasses[model_name].from_dict(model_dict)
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/kiwi/models/model.py", line 235, in from_dict
model.load_state_dict(class_dict[const.STATE_DICT])
File "/home2/zyl/anaconda3/envs/openkiwi/lib/python3.6/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Estimator:
Unexpected key(s) in state_dict: "predictor_tgt.W2", "predictor_tgt.V", "predictor_tgt.C", "predictor_tgt.S", "predictor_tgt.attention.scorer.layers.0.0.weight", "predictor_tgt.attention.scorer.layers.0.0.bias", "predictor_tgt.attention.scorer.layers.1.0.weight", "predictor_tgt.attention.scorer.layers.1.0.bias", "predictor_tgt.embedding_source.weight", "predictor_tgt.embedding_target.weight", "predictor_tgt.lstm_source.weight_ih_l0", "predictor_tgt.lstm_source.weight_hh_l0", "predictor_tgt.lstm_source.bias_ih_l0", "predictor_tgt.lstm_source.bias_hh_l0", "predictor_tgt.lstm_source.weight_ih_l0_reverse", "predictor_tgt.lstm_source.weight_hh_l0_reverse", "predictor_tgt.lstm_source.bias_ih_l0_reverse", "predictor_tgt.lstm_source.bias_hh_l0_reverse", "predictor_tgt.lstm_source.weight_ih_l1", "predictor_tgt.lstm_source.weight_hh_l1", "predictor_tgt.lstm_source.bias_ih_l1", "predictor_tgt.lstm_source.bias_hh_l1", "predictor_tgt.lstm_source.weight_ih_l1_reverse", "predictor_tgt.lstm_source.weight_hh_l1_reverse", "predictor_tgt.lstm_source.bias_ih_l1_reverse", "predictor_tgt.lstm_source.bias_hh_l1_reverse", "predictor_tgt.forward_target.weight_ih_l0", "predictor_tgt.forward_target.weight_hh_l0", "predictor_tgt.forward_target.bias_ih_l0", "predictor_tgt.forward_target.bias_hh_l0", "predictor_tgt.forward_target.weight_ih_l1", "predictor_tgt.forward_target.weight_hh_l1", "predictor_tgt.forward_target.bias_ih_l1", "predictor_tgt.forward_target.bias_hh_l1", "predictor_tgt.backward_target.weight_ih_l0", "predictor_tgt.backward_target.weight_hh_l0", "predictor_tgt.backward_target.bias_ih_l0", "predictor_tgt.backward_target.bias_hh_l0", "predictor_tgt.backward_target.weight_ih_l1", "predictor_tgt.backward_target.weight_hh_l1", "predictor_tgt.backward_target.bias_ih_l1", "predictor_tgt.backward_target.bias_hh_l1", "predictor_tgt.W1.weight".
您有遇到这个问题吗?能不能分享一下您的predict_estimator.yaml
文件?
from openkiwi.
from openkiwi.
我是用命令行跑的,都跑通了,但我是先跑完了predictor,后来发现不对,于是在上边提了issue,后来作者给更新了代码,我就也一样更新了下我本地的代码,接着跑的estimator,然后就可以了~ [email protected] From: Hongzheng Li Date: 2019-04-26 15:41 To: Unbabel/OpenKiwi CC: hqWu; Mention Subject: Re: [Unbabel/OpenKiwi] Error training estimator model (#18) @HqWu-HITCS 不好意思,再次打扰了~ 请问你后来用最新的repo把整个QE的流程都跑通了是吗?你是用哪种方式跑的?是命令行方式kiwi train --config=train_estimator.yaml 还是在py文件里调用的呢? import kiwi estimator_config = 'train_estimator.yaml' kiwi.train(estimator_config) 我用了两种方式,始终都跑不通…… — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
你能再给我一份train_predictor.yaml的配置文件吗?多谢多谢!
from openkiwi.
@HqWu-HITCS 你好,能告知一下你运行Openkiwi的Python版本吗?
from openkiwi.
Hey guys, could you please write in English so we understand what is going on and are able to help?
Thanks
from openkiwi.
Hey guys, could you please write in English so we understand what is going on and are able to help?
Thanks
@captainvera Sorry for that. We've been talking about the errors happened during the train_estimator
and next predictor
step, as discussed in #22 and #23, for #22 , the error TypeError: 'NoneType' object is not subscriptable always exists, even with the latest repo of the openkiwi toolkit.
from openkiwi.
Hey guys, could you please write in English so we understand what is going on and are able to help?
Thanks
Hi @captainvera, as VictorLi2017 said, I am talking about the errors happened during the predictor
step, as discussed in #23, the error Error(s) in loading state_dict for Estimator always exists.
from openkiwi.
@VictorLi2017 @Zachary-YL I understand. While it is excellent that you're trying to help each other with the issues, it is more beneficial if you keep it In English so we can all gain from the discussion! :)
On our end, we apologize but we are currently extremely busy internally. As such we will get back to you in a couple of weeks.
from openkiwi.
Related Issues (20)
- TypeError: cannot unpack non-iterable NoneType object HOT 1
- The prediction process is not complete by Predictor Estimator. HOT 5
- OpenKiwi always download the tokenizer files for XLMRoberta even if a local path is configured. HOT 2
- Do openKiwi have confident score? HOT 1
- Error Pre-Training Predictor: "model -> encoder -> encode_source extra fields not permitted (type=value_error.extra)" HOT 1
- some confusions
- pkgutil.iter_modules() error: 'PosixPath' object has no attribute 'startswith'
- Got exception when import kiwi
- Seems that maximum token support for a sentence is 512?
- PicklingError: Can't pickle <class 'kiwi.data.encoders.wmt_qe_data_encoder.InputFields[PositiveInt]'>: attribute lookup InputFields[PositiveInt] on kiwi.data.encoders.wmt_qe_data_encoder failed HOT 2
- Do you need to tokenize your data when using a BERT/ROBERTA model?
- Pretrain config file
- What are source_pos and target_pos in the train_config.yaml?
- Why does it need "--model" paramter when I give a specific config? HOT 2
- What languages do the OpenKiwi support?
- some problems about data without alignments HOT 11
- I suppose that the code comment should be remove. HOT 2
- Error at Predictor Training: "Predictor is not a subclass of QESystem" HOT 2
- OSError: Can't load weights for 'xlm-roberta-base'. HOT 16
- open cannot unpack non-iterable NoneType object HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openkiwi.