ludwig 训练一个简单的聊天机器人模型,

5n0oy7gb  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(22)

你好!

根据你提供的信息,这个问题可能是由于数据集的特征数量与模型输入特征不匹配导致的。在你的config.yaml文件中,input_features部分的Eu特征的类型是text,但实际上你的数据集中的Eu特征是一个单词列表。你需要将Eu特征的类型更改为tokens,并设置一个合适的词汇表大小。同时,你需要确保output_features部分的Chatbot特征的类型也是tokens

请尝试按照以下步骤修改你的config.yaml文件:

  1. input_features部分的Eu特征的类型更改为tokens,并设置一个合适的词汇表大小。例如,如果你的数据集中的最大单词数是256,你可以将词汇表大小设置为256:
input_features:
  -
    name: Eu
    type: tokens
    vocab_size: 256
    level: word
    encoder: rnn
    cell_type: lstm
    reduce_output: null
  1. 确保output_features部分的Chatbot特征的类型也是tokens,并设置一个合适的词汇表大小。例如,如果你的数据集中的最大单词数是256,你可以将词汇表大小设置为256:
output_features:
  -
    name: Chatbot
    type: tokens
    vocab_size: 256
    level: word
    decoder: generator
    cell_type: lstm
    attention: bahdanau
    loss: sampled_softmax_cross_entropy
  1. 在运行实验之前,确保你的数据集已经正确地加载到Ludwig中。你可以使用以下命令来加载数据集:
ludwig experiment --dataset eu.csv --config_file config.yaml --no_cache --force_reload_dataloaders --skip_save_processed_data --skip_save_progress --skip_save_unprocessed_data --skip_save_model --skip_validation --verbose

希望这可以帮助你解决问题!

1l5u6lss

1l5u6lss1#

感谢您提出这个问题。您的模型应该能在提供的数据显示出效果。我会去查看一下。同时,之前帮助解决序列解码问题的@jimthompson5802可能对此有独到的见解。

daupos2t

daupos2t2#

你好,你能解决这个问题吗?
在更新ludwig后,我遇到了相同的错误。之前使用pre tensroflow2更新相同的数据集和model_definition可以正常工作。但是在更新后,相同的代码和数据会报错:

ValueError: Invalid reduction dimension 2 for input with 2 dimensions. for '{{node ecd/text_output_feature/Max}} = Max[T=DT_FLOAT, Tidx=DT_INT32, keep_dims=false](ecd/text_output_featu
re/Abs_1, ecd/text_output_feature/Max/reduction_indices)' with input shapes: [128,512], [] and with computed input tensors: input[1] = <2>.

相关问题