未验证 提交 5d346474 编写于 作者: HansBug's avatar HansBug 😆 提交者: GitHub

Merge pull request #13 from opendilab/dev/py310

dev(hansbug): add test for torch1.12.0 and python3.10
......@@ -21,6 +21,7 @@ jobs:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
numpy-version:
- '1.18.0'
- '1.22.0'
......@@ -28,15 +29,24 @@ jobs:
- '1.2.0'
- '1.6.0'
- '1.10.0'
- '1.12.0'
exclude:
- python-version: '3.7'
numpy-version: '1.22.0'
- python-version: '3.10'
numpy-version: '1.18.0'
- python-version: '3.8'
torch-version: '1.2.0'
- python-version: '3.9'
torch-version: '1.2.0'
- python-version: '3.9'
torch-version: '1.6.0'
- python-version: '3.10'
torch-version: '1.2.0'
- python-version: '3.10'
torch-version: '1.6.0'
- python-version: '3.10'
torch-version: '1.10.0'
- os: 'windows-2019'
torch-version: '1.2.0'
- os: 'windows-2019'
......@@ -44,6 +54,9 @@ jobs:
- os: 'windows-2019'
python-version: '3.9'
numpy-version: '1.18.0'
- os: 'windows-2019'
python-version: '3.10'
numpy-version: '1.18.0'
steps:
- name: Get system version for Linux
......
coverage>=5
mock>=4.0.3
flake8~=3.5
pytest~=5.4.3
pytest-cov~=2.10.1
pytest-mock~=3.5.1
pytest-forked~=1.3.0
pytest-xdist~=1.34.0
pytest-timeout~=1.4.2
pytest-rerunfailures~=9.1.1
pytest~=6.2.5
pytest-cov~=3.0.0
pytest-mock~=3.6.1
pytest-xdist>=1.34.0
pytest-rerunfailures~=10.2
pytest-timeout~=2.0.2
pytest-benchmark~=3.4.0
easydict>=1.7,<2
......@@ -3,7 +3,7 @@ import unittest
import numpy as np
import pytest
import torch
from hbutils.testing import OS
from hbutils.testing import OS, vpython
import treetensor.numpy as tnp
import treetensor.torch as ttorch
......@@ -246,6 +246,11 @@ class TestNumpyArray:
}
})
# Here is a bug in torch on Windows and python3.10 environment
# RuntimeError: Numpy is not available
# The only solution I found is to downgrade python to 3.9 ==,
# so this is currently unsolvable.
@unittest.skipIf(OS.windows and vpython >= '3.10', 'Bug in torch')
def test_tensor(self):
assert ttorch.isclose(self._DEMO_1.tensor().double(), ttorch.Tensor({
'a': ttorch.Tensor([[1, 2, 3], [4, 5, 6]]),
......
import unittest
import numpy as np
import torch
from hbutils.testing import vpython, OS
from treevalue import typetrans, TreeValue, func_treelize
import treetensor.numpy as tnp
......@@ -47,6 +50,11 @@ class TestTorchTensorClass:
def test_numel(self):
assert self._DEMO_1.numel() == 18
# Here is a bug in torch on Windows and python3.10 environment
# RuntimeError: Numpy is not available
# The only solution I found is to downgrade python to 3.9 ==,
# so this is currently unsolvable.
@unittest.skipIf(OS.windows and vpython >= '3.10', 'Bug in torch')
@choose_mark()
def test_numpy(self):
assert tnp.all(self._DEMO_1.numpy() == tnp.ndarray({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册