Unbabel / OpenKiwi

Open-Source Machine Translation Quality Estimation in PyTorch
https://unbabel.github.io/OpenKiwi/
GNU Affero General Public License v3.0
229 stars 48 forks source link

some problems about data without alignments #95

Closed leileilin closed 3 years ago

leileilin commented 3 years ago

i chage the data.yaml, just delete the alignments of it. and i get the following error. KeyError: 'alignments' anyone can tell me if i dont have alignments, how to train it? thank you.

zhaofuchen commented 3 years ago

对齐文件是必须的,否则无法训练。你可以使用下面项目制作对齐文件: https://github.com/Unbabel/word-level-qe-corpus-builder

leileilin commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

    你好,我已经在有对齐文件的条件下训练了nuqe模型,但是为什么预测的时候也要对齐吗?
    因为我在预测源句子和翻译句子的时候报了一样的错误。非常感谢!

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/17/2021 ***@***.***> wrote: 

对齐文件是必须的,否则无法训练。你可以使用下面项目制作对齐文件:

https://github.com/Unbabel/word-level-qe-corpus-builder

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

zhaofuchen commented 3 years ago

训练和预测输入的数据是一样的,本质上预测就是使用已训练好的模型参数。 所以预测也需要对齐信息。

leileilin commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

那我问一下,就是OpenKiwi框架里的所有模型的训练和预测输入的数据都需要对齐数据吗?还是只有nuqe需要?非常感谢!

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/17/2021 ***@***.***> wrote: 

训练和预测输入的数据是一样的,本质上预测就是使用已训练好的模型参数。

所以预测也需要对齐信息。

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

zhaofuchen commented 3 years ago

全部都需要,个人建议你别折腾nuqe了,这个模型效果没有其他的好。还有就是 estimator-predictor模型预训练官方有训练好的模型,不要自己训练。你找找看,我不记得了。 BERT,XLM,XLM-Roberta这三个模型是基于transformers实现的,目前效果比较好。

leileilin commented 3 years ago

好的,谢谢!------------------ 原始邮件 ------------------ @.> 发送时间: 2021年3月17日(星期三) 下午2:28 @.>; @.**@.>; 主题: Re: [Unbabel/OpenKiwi] some problems about data without alignments (#95)

leileilin commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

你好,当我用BERT和XLM-R训练的时候,总是会报错:

    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你知道这是因为什么吗?非常感谢!

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/17/2021 ***@***.***> wrote: 

全部都需要,个人建议你别折腾nuqe了,这个模型效果没有其他的好。还有就是 estimator-predictor模型预训练官方有训练好的模型,不要自己训练。你找找看,我不记得了。 BERT,XLM,XLM-Roberta这三个模型是基于transformers实现的,目前效果比较好。

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

leileilin commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

    不好意思,已经解决了,当我用gpu训练的时候不会报这个错误。

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/22/2021 ***@***.***> wrote: 

font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

你好,当我用BERT和XLM-R训练的时候,总是会报错:

    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你知道这是因为什么吗?非常感谢!

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/17/2021 ***@***.***> wrote: 

全部都需要,个人建议你别折腾nuqe了,这个模型效果没有其他的好。还有就是 estimator-predictor模型预训练官方有训练好的模型,不要自己训练。你找找看,我不记得了。 BERT,XLM,XLM-Roberta这三个模型是基于transformers实现的,目前效果比较好。

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

leileilin commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

    不好意思,已经解决了,当我用cpu训练时不会报这个错误,但是当我用一个gpu训练时会报错:TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/22/2021 ***@***.***> wrote: 

font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

你好,当我用BERT和XLM-R训练的时候,总是会报错:

    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你知道这是因为什么吗?非常感谢!

                            1299192319

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 3/17/2021 ***@***.***> wrote: 

全部都需要,个人建议你别折腾nuqe了,这个模型效果没有其他的好。还有就是 estimator-predictor模型预训练官方有训练好的模型,不要自己训练。你找找看,我不记得了。 BERT,XLM,XLM-Roberta这三个模型是基于transformers实现的,目前效果比较好。

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

Roshanson commented 3 years ago

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

在 kiwi/metrics/functions.py:96 加上如下代码

    if not isinstance(hat_y, list):
        hat_y = hat_y.cpu()
    if not isinstance(y, list):
        y = y.cpu()

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

这个问题在使用多块GPU的时候我也遇到了。。 也不知道怎么改 = =

zhaofuchen commented 3 years ago

抱歉额,我也没遇到过,帮不了你。

------------------ 原始邮件 ------------------ 发件人: "Unbabel/OpenKiwi" @.>; 发送时间: 2021年4月21日(星期三) 下午5:47 @.>; @.**@.>; 主题: Re: [Unbabel/OpenKiwi] some problems about data without alignments (#95)

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

在 kiwi/metrics/functions.py:96 加上如下代码 if not isinstance(hat_y, list): hat_y = hat_y.cpu() if not isinstance(y, list): y = y.cpu()
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

这个问题在使用多块GPU的时候我也遇到了。。 也不知道怎么改 = =

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.