Open alex4321 opened 3 years ago
Also, I'm getting error with tests\test_cli.py
:
@pytest.mark.light
def test_complex_cli_v1():
env = os.environ.copy()
env['PYTHONPATH'] = '.'
cmd = [
sys.executable,
'./bin/kbc-cli.py',
'--train', 'data/wn18rr/dev.tsv',
'--dev', 'data/wn18rr/dev.tsv',
'--test', 'data/wn18rr/test.tsv',
'-m', 'complex',
'-k', '100',
'-b', '100',
'-e', '1',
'--N3', '0.0001',
'-l', '0.1',
'-V', '1',
'-o', 'adagrad',
'-B', '2000'
]
p = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=os.getcwd())
out, err = p.communicate()
out_str = out.decode("utf-8")
err_str = err.decode("utf-8")
assert p.returncode == 0, f"Process exited with {p.returncode} code\nOutput: {out_str}\nError: {err_str}"
sys.stdout = sys.stderr
lines = out_str.split("\n")
sanity_check_flag_1 = False
for line in lines:
if 'Batch 1/31' in line:
value = float(line.split()[5])
np.testing.assert_allclose(value, 18.311768, atol=1e-3, rtol=1e-3)
if 'Batch 10/31' in line:
value = float(line.split()[5])
np.testing.assert_allclose(value, 18.273418, atol=1e-3, rtol=1e-3)
if 'Final' in line and 'dev results' in line:
value = float(line.split()[4])
> np.testing.assert_allclose(value, 0.116451, atol=1e-3, rtol=1e-3)
E AssertionError:
E Not equal to tolerance rtol=0.001, atol=0.001
E
E Mismatched elements: 1 / 1 (100%)
E Max absolute difference: 0.312262
E Max relative difference: 2.68148835
E x: array(0.428713)
E y: array(0.116451)
tests\test_cli.py:55: AssertionError
All other test passes
I got few problems with data types (torch
Embeddings
requiredLongTensor
instead ofIntTensor
). Yet when I specified tensor types explicitly - you can see https://github.com/alex4321/ctp - I got problems runningtest_smart_clutrr_v5
intest_smart_clutrr.py
:(lines 515-520)
But I got next values:
So only first two assertions passes.
(
test_classic.py
works fine with the same data, so I guess it should be some problem withkbcr.clutrr.models.smart.NeuralKB
,kbcr.clutrr.models.smart.Hoppy
? Also, previous teststest_smart_clutrr_v1
-test_smart_clutrr_v4
passed succesfully too)