mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-06 12:07:04 +00:00
fix UserWarning from slow tensor conversion (#1948)
* fix UserWarning from slow tensor conversion * Add latest docstring and tutorial changes Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
30ea1d475d
commit
db76a5c5c6
@ -62,7 +62,7 @@ def convert_features_to_dataset(features):
|
||||
"Converting now to a tensor of default type long.")
|
||||
|
||||
# Convert all remaining python objects to torch long tensors
|
||||
cur_tensor = torch.tensor([sample[t_name] for sample in features], dtype=torch.long)
|
||||
cur_tensor = torch.as_tensor(np.array([sample[t_name] for sample in features]), dtype=torch.long)
|
||||
|
||||
all_tensors.append(cur_tensor)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user