I;m working on language modeling and using LSTM. I have txt file in which pair of person name and and there native language is given e.g (zack,france
ali,india) and i have converted it into one list name of person and in one list i have name of countries .eg.
name=[" Ali",“zack”]
lang=[ “france”,“india”]
now i want to convert these to list into tensors .I have tried like in two ways
-
name = torch.from_numpy(name)
-
name = [float(name) for x in name]
name = np.asarray(name)
name = torch.from_numpy(name)
but in first case it says list object dont have to obbject so i tried to convert it into float first so that i can convert them into tensor because in the documentation it says it can convert something like that The only supported types are: double, float, int64, int32, and uint8.
and in second case its giving error like this could not convert string to float: ‘Abreu’ where ‘Abreu’ is person name.
Can anyone help me how to convert this thing into tensor.Thank You