我正在编写 Python 代码,在这部分代码中,我想使用 Metal 来训练我的模型,如下所示:
from metal.label_model import LabelModel
gen_model = LabelModel()
%time gen_model.train(L_train[0], n_epochs=500, print_every=100)
但是这给出了:
TypeError
Traceback (most recent call last)
<timed eval> in <module>
TypeError: train() got an unexpected keyword argument 'n_epochs'
最佳答案
0.3.0 中有一个变化:
'Renames Classifier.train to Classifier.train_model to avoid overwriting the nn.Module.train function'
因此,请尝试使用 train_model()
而不是 train()
:
from metal.label_model import LabelModel
gen_model = LabelModel()
%time gen_model.train_model(L_train[0], n_epochs=500, print_every=100)
来源:
https://github.com/HazyResearch/metal/commit/4210c7c66f3f4a6fc7287192aec133c293ed8198
关于python - Metal 火车出现意外的关键字参数 'n_epochs',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52963958/