Open hkvision opened 5 years ago
Also, seems we currently support torch 1.1.0, while nlp-architect depends on 1.2.0. Not sure whether there will be potential conflicts.
It seems that TorchNet currently only accept float as input: https://github.com/intel-analytics/analytics-zoo/blob/master/zoo/src/main/java/com/intel/analytics/zoo/pipeline/api/net/native/com_intel_analytics_zoo_pipeline_api_net_PytorchModel.cpp#L219
@jason-dai I tried to change all the corresponding data types from float32 to long and we forward an embedding can work. Seems torch embedding can only accept long type as input, please kindly verify @hhbyyh . Also I may want to ask you for suggestions on the best way to handle different data types in TorchNet. @hhbyyh Thanks.
@jason-dai After I change input type to Long, now TorchNet can load BERT successfully :). [Need to use torch 1.1.0; 1.2.0, required by nlp-architect will encounter unexpected problems]
As guided by @hhbyyh when creating torch model, can add a cast to long before passing to embedding. I will make a pr for this after fix migrating pytorch bert.
Embedding requires LongTensor?
TorchNet.from_pytorch
, ifinput
is a shape tuple, then it will throw error since a random float tensor will be created:I change to input a torch tensor directly and torchnet can be created.
Code to repro: