这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.

Conversation

@lenguyenthedat
Copy link
Contributor

  • Remove unused imports
  • Remove the need of context.py file (it's quite confusing to use and will throw flake8 / pep8 off)

Unit test log:

(the failures are because of Torch not compiled with CUDA enabled)

$ python3 -m unittest test/data_layer_tests.py
Test 1 started
Total items found: 163
.Total items found: 163
0
torch.Size([32, 19547])
1
torch.Size([32, 19547])
2
torch.Size([32, 19547])
3
torch.Size([32, 19547])
4
torch.Size([32, 19547])
.
----------------------------------------------------------------------
Ran 2 tests in 0.199s

OK
$ python3 -m unittest test/test_model.py
iRecAutoEncoderTest Test on  CPU started
Vector dim: 19547
Total items found: 163
******************************
******************************
[19547, 256, 128]
Dropout drop probability: 0.0
Encoder pass:
torch.Size([256, 19547])
torch.Size([256])
torch.Size([128, 256])
torch.Size([128])
Decoder pass:
Decoder is constrained
torch.Size([256, 128])
torch.Size([256])
torch.Size([19547, 256])
torch.Size([19547])
******************************
******************************
AutoEncoder (
  (encode_w): ParameterList (
  )
  (encode_b): ParameterList (
  )
  (decode_b): ParameterList (
  )
)
<generator object Module.parameters at 0x10fefb990>
[0,     0] loss: 13.7627230
[0,     1] loss: 15.5718050
[1,     0] loss: 14.1457729
[1,     1] loss: 14.2564306
[2,     0] loss: 14.7592907
[2,     1] loss: 13.3936634
[3,     0] loss: 13.4373884
[3,     1] loss: 13.8697548
[4,     0] loss: 12.5413427
[4,     1] loss: 13.3834724
[5,     0] loss: 12.0962524
[5,     1] loss: 10.2871866
[6,     0] loss: 11.9361048
[6,     1] loss: 12.7510881
[7,     0] loss: 11.2688084
[7,     1] loss: 8.9151201
[8,     0] loss: 6.6534214
[8,     1] loss: 10.7530689
[9,     0] loss: 5.4654245
[9,     1] loss: 8.7021055
[10,     0] loss: 4.8678174
[10,     1] loss: 8.9395142
[11,     0] loss: 8.0163450
[11,     1] loss: 5.3523836
[12,     0] loss: 4.6805806
[12,     1] loss: 5.7746768
[13,     0] loss: 4.6549287
[13,     1] loss: 4.6210918
[14,     0] loss: 4.5356889
[14,     1] loss: 3.7206159
[15,     0] loss: 3.3543446
[15,     1] loss: 3.7410641
[16,     0] loss: 5.0429521
[16,     1] loss: 2.9728928
[17,     0] loss: 3.3243787
[17,     1] loss: 2.6175928
[18,     0] loss: 2.3361208
[18,     1] loss: 2.8326197
[19,     0] loss: 3.0278883
[19,     1] loss: 2.6812475
.iRecAutoEncoderTest Test on GPU started
Total items found: 163
******************************
******************************
[19547, 1024, 512, 512, 512, 512, 128]
Dropout drop probability: 0.0
Encoder pass:
torch.Size([1024, 19547])
torch.Size([1024])
torch.Size([512, 1024])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([128, 512])
torch.Size([128])
Decoder pass:
Decoder is constrained
torch.Size([512, 128])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([1024, 512])
torch.Size([1024])
torch.Size([19547, 1024])
torch.Size([19547])
******************************
******************************
FuRecAutoEncoderTest Test on  CPU started
Vector dim: 11259
Total items found: 97618
******************************
******************************
[11259, 128, 11259]
Dropout drop probability: 0.0
Encoder pass:
torch.Size([128, 11259])
torch.Size([128])
torch.Size([11259, 128])
torch.Size([11259])
Decoder pass:
Decoder is constrained
torch.Size([128, 11259])
torch.Size([128])
torch.Size([11259, 128])
torch.Size([11259])
******************************
******************************
[0,     0] loss: 10.4307327
[0,     1] loss: 11.3560009
[0,     2] loss: 10.5129652
[0,     3] loss: 10.8210392
[0,     4] loss: 10.5824280
[0,     5] loss: 9.0050182
.uRecAutoEncoderTest Test on GPU started
Total items found: 97618
******************************
******************************
[11259, 1024, 512, 512, 128]
Dropout drop probability: 0.0
Encoder pass:
torch.Size([1024, 11259])
torch.Size([1024])
torch.Size([512, 1024])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([128, 512])
torch.Size([128])
Decoder pass:
Decoder is constrained
torch.Size([512, 128])
torch.Size([512])
torch.Size([512, 512])
torch.Size([512])
torch.Size([1024, 512])
torch.Size([1024])
torch.Size([11259, 1024])
torch.Size([11259])
******************************
******************************
F
======================================================================
FAIL: test_GPU (test.test_model.iRecAutoEncoderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/intoth3rainbow/Dropbox/GitHub/cabinet/DeepRecommender/test/test_model.py", line 45, in test_GPU
    encoder.cuda()
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 147, in cuda
    return self._apply(lambda t: t.cuda(device_id))
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 118, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 124, in _apply
    param.data = fn(param.data)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 147, in <lambda>
    return self._apply(lambda t: t.cuda(device_id))
  File "/usr/local/lib/python3.6/site-packages/torch/_utils.py", line 66, in _cuda
    return new_type(self.size()).copy_(self, async)
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 266, in _lazy_new
    _lazy_init()
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 84, in _lazy_init
    _check_driver()
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 51, in _check_driver
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

======================================================================
FAIL: test_GPU (test.test_model.uRecAutoEncoderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/intoth3rainbow/Dropbox/GitHub/cabinet/DeepRecommender/test/test_model.py", line 97, in test_GPU
    encoder.cuda()
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 147, in cuda
    return self._apply(lambda t: t.cuda(device_id))
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 118, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 124, in _apply
    param.data = fn(param.data)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 147, in <lambda>
    return self._apply(lambda t: t.cuda(device_id))
  File "/usr/local/lib/python3.6/site-packages/torch/_utils.py", line 66, in _cuda
    return new_type(self.size()).copy_(self, async)
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 266, in _lazy_new
    _lazy_init()
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 84, in _lazy_init
    _check_driver()
  File "/usr/local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 51, in _check_driver
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

----------------------------------------------------------------------
Ran 4 tests in 7.768s

FAILED (failures=2)

@okuchaiev
Copy link
Member

Looks good. Thanks!

@okuchaiev okuchaiev merged commit 2c58d27 into NVIDIA:master Oct 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants