简单的变形金刚什么都不生产?
Simple Transformers producing nothing?
我有一个看起来像这样的简单变形金刚脚本。
from simpletransformers.seq2seq import Seq2SeqModel, Seq2SeqArgs
args = Seq2SeqArgs()
args.num_train_epoch=5
model = Seq2SeqModel(
"roberta",
"roberta-base",
"bert-base-cased",
)
import pandas as pd
df = pd.read_csv('english-french.csv')
df['input_text'] = df['english'].values
df['target_text'] =df['french'].values
model.train_model(df.head(1000))
print(model.eval_model(df.tail(10)))
eval_loss是{'eval_loss': 0.0001931049264385365}
但是当我 运行 我的预测脚本
to_predict = ["They went to the public swimming pool."]
predictions=model.predict(to_predict)
我明白了
['']
我使用的数据集是here
我对输出结果很困惑。任何帮助或解释为什么 returns 什么都不会感激。
改为使用此模型。
model = Seq2SeqModel(
encoder_decoder_type="marian",
encoder_decoder_name="Helsinki-NLP/opus-mt-en-mul",
args=args,
use_cuda=True,
)
roBERTa 不是您完成任务的好选择。
我已经在 this colab notebook
重写了你的代码
结果
# Input
to_predict = ["They went to the public swimming pool.", "she was driving the shiny black car."]
predictions = model.predict(to_predict)
print(predictions)
# Output
['Ils aient cher à la piscine publice.', 'elle conduit la véricine noir glancer.']
我有一个看起来像这样的简单变形金刚脚本。
from simpletransformers.seq2seq import Seq2SeqModel, Seq2SeqArgs
args = Seq2SeqArgs()
args.num_train_epoch=5
model = Seq2SeqModel(
"roberta",
"roberta-base",
"bert-base-cased",
)
import pandas as pd
df = pd.read_csv('english-french.csv')
df['input_text'] = df['english'].values
df['target_text'] =df['french'].values
model.train_model(df.head(1000))
print(model.eval_model(df.tail(10)))
eval_loss是{'eval_loss': 0.0001931049264385365}
但是当我 运行 我的预测脚本
to_predict = ["They went to the public swimming pool."]
predictions=model.predict(to_predict)
我明白了
['']
我使用的数据集是here
我对输出结果很困惑。任何帮助或解释为什么 returns 什么都不会感激。
改为使用此模型。
model = Seq2SeqModel(
encoder_decoder_type="marian",
encoder_decoder_name="Helsinki-NLP/opus-mt-en-mul",
args=args,
use_cuda=True,
)
roBERTa 不是您完成任务的好选择。
我已经在 this colab notebook
重写了你的代码结果
# Input
to_predict = ["They went to the public swimming pool.", "she was driving the shiny black car."]
predictions = model.predict(to_predict)
print(predictions)
# Output
['Ils aient cher à la piscine publice.', 'elle conduit la véricine noir glancer.']