Solved by ptrblck in post #2 
              
              
                You could create the model first, load the parameters from the .txt file, transform them to floats and then tensors, and load each parameter manually via: 
with torch.no_grad():
    model.layerX.weight.copy_(layerX_weight)
    model.layerX.bias.copy_(layerX_bias)

Note that his approach is a bit ted…