MockingBird icon indicating copy to clipboard operation
MockingBird copied to clipboard

训练时出现问题:Creating a tensor from a list of numpy.ndarrays is extremely slow.

Open sage1109 opened this issue 3 years ago • 1 comments

Summary[问题简述(一句话)] Creating a tensor from a list of numpy.ndarrays is extremely slow. 训练时出现这个,CPU占用率也不高,如何解决

Env & To Reproduce[复现与环境] 描述你用的环境、代码版本、模型

Screenshots[截图(如有)] If applicable, add screenshots to help E:\mockingbird\MockingBird-main\MockingBird-main\synthesizer\synthesizer_dataset.py:84: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_new.cpp:210.) embeds = torch.tensor(embeds) E:\mockingbird\MockingBird-main\MockingBird-main\synthesizer\synthesizer_dataset.py:84: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_new.cpp:210.) embeds = torch.tensor(embeds) E:\mockingbird\Python\lib\site-packages\torch\nn\functional.py:1933: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead. warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")

sage1109 avatar Sep 04 '22 13:09 sage1109

手动修改下吧 如果不希望看到 warning 不过据说效率 反而差点。 embeds = [x[2] for x in batch] 修改成 embeds = np.array([x[2] for x in batch])

jerrytt avatar Dec 06 '22 05:12 jerrytt