Giter VIP home page Giter VIP logo

pykale / pykale Goto Github PK

View Code? Open in Web Editor NEW
427.0 11.0 64.0 20.03 MB

Knowledge-Aware machine LEarning (KALE): accessible machine learning from multiple sources for interdisciplinary research, part of the πŸ”₯PyTorch ecosystem. ⭐ Star to support our work!

Home Page: https://pykale.github.io/

License: MIT License

Python 100.00%
machine-learning knowledge-aware-learning computer-vision graph-analysis pytorch medical-image-analysis multimodal-learning transfer-learning domain-adaptation data-science

pykale's Introduction

project-pykale

Very cool library with lots of great ideas on moving toward 'green', efficient multimodal machine learning and AI.

Kevin Carlberg, AI Research Science Manager at Facebook Reality Labs (quoted from tweet).


tests codecov GitHub license Python PyPI version PyPI downloads

Getting Started | Documentation | Contributing | Discussions | Changelog

PyKale is a library in the PyTorch ecosystem aiming to make machine learning more accessible to interdisciplinary research by bridging gaps between data, software, and end users. Both machine learning experts and end users can do better research with our accessible, scalable, and sustainable design, guided by green machine learning principles. PyKale has a unified pipeline-based API and focuses on multimodal learning and transfer learning for graphs, images, and videos at the moment, with supporting models on deep learning and dimensionality reduction.

PyKale enforces standardization and minimalism, via green machine learning concepts of reducing repetitions and redundancy, reusing existing resources, and recycling learning models across areas. PyKale will enable and accelerate interdisciplinary, knowledge-aware machine learning research for graphs, images, and videos in applications including bioinformatics, graph analysis, image/video recognition, and medical imaging, with an overarching theme of leveraging knowledge from multiple sources for accurate and interpretable prediction.

See our arXiv preprint and four short introductory videos on YouTube: Why build PyKale? How was PyKale built? What's in PyKale? and a 5-min summary.

Pipeline-based API

  • loaddata loads data from disk or online resources as input
  • prepdata preprocesses data to fit machine learning modules below (transforms)
  • embed embeds data in a new space to learn a new representation (feature extraction/selection)
  • predict predicts a desired output
  • evaluate evaluates the performance using some metrics
  • interpret interprets the features and outputs via post-prediction analysis mainly via visualization
  • pipeline specifies a machine learning workflow by combining several other modules

Example usage

  • examples demonstrate real applications on specific datasets with a standardized structure.

How to Use

Step 0: Installation

PyKale supports Python 3.8, 3.9, or 3.10. Before installing pykale, we suggest you to first install PyTorch matching your hardware, and if graphs will be used, install PyTorch Geometric following its official instructions.

Simple installation of pykale from PyPI:

pip install pykale

For more details and other options, please refer to the installation guide.

Step 1: Tutorials and Examples

Start with a brief tutorial walking through API usage in examples or interactive Jupyter notebook tutorials, e.g. Open in Colab or Binder for a basic digit classification problem.

Browse through the examples to see the usage of PyKale in performing various prediction tasks in a wide range of applications, using a variety of settings, e.g. with or without PyTorch Lightning.

Ask questions on PyKale's GitHub Discussions tab if you need help or create an issue if you find som

Step 2: Building and Contributing

Build new modules and/or projects with PyKale referring to the tutorial, e.g., on how to modify an existing pipeline or build a new one.

This is an open-source project welcoming your contributions. You can contribute in three ways:

  • Star and fork PyKale to follow its latest developments, share it with your networks, and ask questions about it.
  • Use PyKale in your project and let us know any bugs (& fixes) and feature requests/suggestions via creating an issue.
  • Contribute via branch, fork, and pull for minor fixes and new features, functions, or examples to become one of the contributors.

See contributing guidelines for more details. You can also reach us via email if needed. The participation in this open source project is subject to Code of Conduct.

Who We Are

The Team

PyKale is maintained by Haiping Lu, Shuo Zhou, Xianyuan Liu, and Peizhen Bai, with contributions from many other contributors.

Citation

    @inproceedings{pykale-cikm2022,
      title     = {{PyKale}: Knowledge-Aware Machine Learning from Multiple Sources in {Python}},
      author    = {Haiping Lu and Xianyuan Liu and Shuo Zhou and Robert Turner and Peizhen Bai and Raivo Koot and Mustafa Chasmai and Lawrence Schobs and Hao Xu},
      booktitle = {Proceedings of the 31st ACM International Conference on Information and Knowledge Management (CIKM)},
      doi       = {10.1145/3511808.3557676},
      year      = {2022}
    }

Please consider citing our CIKM2022 paper above if you find PyKale useful to your research.

Acknowledgements

The development of PyKale is partially supported by the following project(s).

  • Wellcome Trust Innovator Awards: Digital Technologies Ref 215799/Z/19/Z "Developing a Machine Learning Tool to Improve Prognostic and Treatment Response Assessment on Cardiac MRI Data".

pykale's People

Contributors

19valentin99 avatar alanbijuthomas avatar bobturneruk avatar dependabot[bot] avatar drj11 avatar github-actions[bot] avatar haipinglu avatar kennedy12335 avatar mdnaimulislam avatar mustafa1728 avatar nyxflower avatar peizhenbai avatar raivokoot avatar schobs avatar shuo-zhou avatar sinatabakhi avatar wang-hlin avatar wenruifan avatar xianyuanliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pykale's Issues

[Bug] `digits_dann_lightn` example command from readme returns an error as it tries to download data from a server.

πŸ› Bug

digits_dann_lightn example command from readme returns an error as it tries to download data from a server.

To reproduce

python main.py --cfg configs/MN2UP-CDAN.yaml --gpus 0

** Stack trace/error message **

DAN:
  METHOD: CDAN
  RANDOM_DIM: 1024
  USERANDOM: False
DATASET:
  DIMENSION: 784
  NAME: digits
  NUM_CLASSES: 10
  NUM_REPEAT: 10
  ROOT: ../data
  SIZE_TYPE: source
  SOURCE: mnist
  TARGET: usps
  WEIGHT_TYPE: natural
OUTPUT:
  DIR: ./outputs\digits_mnist2usps
  PB_FRESH: 0
  ROOT: ./outputs
  VERBOSE: False
SOLVER:
  AD_LAMBDA: True
  AD_LR: True
  BASE_LR: 0.001
  INIT_LAMBDA: 1
  MAX_EPOCHS: 120
  MIN_EPOCHS: 20
  MOMENTUM: 0.9
  NESTEROV: True
  SEED: 2020
  TEST_BATCH_SIZE: 200
  TRAIN_BATCH_SIZE: 150
  TYPE: SGD
  WEIGHT_DECAY: 0.0005
==> Building model for seed 2020 ......
Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to ../data\MNIST\raw\train-images-idx3-ubyte.gz
0it [00:00, ?it/s]Traceback (most recent call last):
  File "main.py", line 91, in <module>
    main()
  File "main.py", line 59, in main
    model, train_params = get_model(cfg, dataset, num_channels)
  File "C:\Users\bobturner\Documents\pykale\examples\digits_dann_lightn\model.py", line 98, in get_model
    model = domain_adapter.create_dann_like(
  File "c:\users\bobturner\documents\pykale\kale\pipeline\domain_adapter.py", line 149, in create_dann_like
    return CDANtrainer(
  File "c:\users\bobturner\documents\pykale\kale\pipeline\domain_adapter.py", line 602, in __init__
    super().__init__(dataset, feature_extractor, task_classifier, critic, **base_params)
  File "c:\users\bobturner\documents\pykale\kale\pipeline\domain_adapter.py", line 468, in __init__
    super().__init__(dataset, feature_extractor, task_classifier, **base_params)
  File "c:\users\bobturner\documents\pykale\kale\pipeline\domain_adapter.py", line 276, in __init__
    self._dataset.prepare_data_loaders()
  File "c:\users\bobturner\documents\pykale\kale\loaddata\multi_domain.py", line 132, in prepare_data_loaders
    (self._source_by_split["train"], self._source_by_split["valid"],) = self._source_access.get_train_val(
  File "c:\users\bobturner\documents\pykale\kale\loaddata\dataset_access.py", line 41, in get_train_val
    train_dataset = self.get_train()
  File "c:\users\bobturner\documents\pykale\kale\loaddata\digits_access.py", line 87, in get_train
    return MNIST(self._data_path, train=True, transform=self._transform, download=True)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\site-packages\torchvision\datasets\mnist.py", line 79, in __init__
    self.download()
  File "C:\Users\bobturner\.conda\envs\pykale\lib\site-packages\torchvision\datasets\mnist.py", line 146, in download
    download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\site-packages\torchvision\datasets\utils.py", line 256, in download_and_extract_archive
    download_url(url, download_root, filename, md5)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\site-packages\torchvision\datasets\utils.py", line 84, in download_url
    raise e
  File "C:\Users\bobturner\.conda\envs\pykale\lib\site-packages\torchvision\datasets\utils.py", line 70, in download_url
    urllib.request.urlretrieve(
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\Users\bobturner\.conda\envs\pykale\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
0it [00:00, ?it/s]

Expected Behaviour

Code should run without error.

Environment

PyTorch version: 1.7.1+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: (tdm64-1) 9.2.0
Clang version: Could not collect
CMake version: Could not collect

Python version: 3.8 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: GeForce GTX 1050 Ti with Max-Q Design
Nvidia driver version: 452.41
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64_7.dll
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.2
[pip3] pytorch-lightning==1.2.10
[pip3] pytorch-memlab==0.2.3
[pip3] torch==1.7.1+cpu
[pip3] torch-cluster==1.5.9
[pip3] torch-geometric==1.7.0
[pip3] torch-scatter==2.0.6
[pip3] torch-sparse==0.6.9
[pip3] torch-spline-conv==1.2.1
[pip3] torchmetrics==0.2.0
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.8.2+cpu
[conda] libblas                   3.9.0                     8_mkl    conda-forge
[conda] libcblas                  3.9.0                     8_mkl    conda-forge
[conda] liblapack                 3.9.0                     8_mkl    conda-forge
[conda] mkl                       2020.4             hb70f87d_311    conda-forge
[conda] numpy                     1.20.2           py38h09042cb_0    conda-forge
[conda] pytorch-lightning         1.2.10                   pypi_0    pypi
[conda] pytorch-memlab            0.2.3                    pypi_0    pypi
[conda] torch                     1.7.1+cpu                pypi_0    pypi
[conda] torch-cluster             1.5.9                    pypi_0    pypi
[conda] torch-geometric           1.7.0                    pypi_0    pypi
[conda] torch-scatter             2.0.6                    pypi_0    pypi
[conda] torch-sparse              0.6.9                    pypi_0    pypi
[conda] torch-spline-conv         1.2.1                    pypi_0    pypi
[conda] torchmetrics              0.2.0                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.8.2+cpu                pypi_0    pypi

[Bug] CI test failed MNIST/M (under conda?)

πŸ› Bug

urllib.error.HTTPError: HTTP Error 503: Service Unavailable seems only in some PR but not in others. I have tested around the same time that the server is fine but not sure why the workflow failed in downloading the data.

To reproduce

Steps to reproduce the behavior:

  1. See https://github.com/pykale/pykale/pull/122/checks?check_run_id=2436851416 and re-run all jobs (expected to fail).
  2. See https://github.com/pykale/pykale/pull/120/checks?check_run_id=2437002058 and re-run all jobs at the same time (expected to succeed)

** Stack trace/error message **

=================================== FAILURES ===================================
__________________________ test_get_train_test[MNIST] __________________________

dataset_name = 'MNIST', download_path = 'tests/test_data/download'

    @pytest.mark.parametrize("dataset_name", ALL)
    def test_get_train_test(dataset_name, download_path):
        source, target, num_channels = DigitDataset.get_source_target(
            DigitDataset(dataset_name), DigitDataset(dataset_name), download_path
        )
>       source_train = source.get_train()

tests/loaddata/test_digits_access.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
kale/loaddata/digits_access.py:87: in get_train
    return MNIST(self._data_path, train=True, transform=self._transform, download=True)
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/mnist.py:79: in __init__
    self.download()
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/mnist.py:146: in download
    download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:256: in download_and_extract_archive
    download_url(url, download_root, filename, md5)
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:84: in download_url
    raise e
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:70: in download_url
    urllib.request.urlretrieve(
/usr/share/miniconda/lib/python3.8/urllib/request.py:247: in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
/usr/share/miniconda/lib/python3.8/urllib/request.py:222: in urlopen
    return opener.open(url, data, timeout)
/usr/share/miniconda/lib/python3.8/urllib/request.py:531: in open
    response = meth(req, response)
/usr/share/miniconda/lib/python3.8/urllib/request.py:640: in http_response
    response = self.parent.error(
/usr/share/miniconda/lib/python3.8/urllib/request.py:569: in error
    return self._call_chain(*args)
/usr/share/miniconda/lib/python3.8/urllib/request.py:502: in _call_chain
    result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib.request.HTTPDefaultErrorHandler object at 0x7fcefa33c1f0>
req = <urllib.request.Request object at 0x7fcefa314310>
fp = <http.client.HTTPResponse object at 0x7fcefa3143d0>, code = 503
msg = 'Service Unavailable'
hdrs = <http.client.HTTPMessage object at 0x7fcefa3145b0>

    def http_error_default(self, req, fp, code, msg, hdrs):
>       raise HTTPError(req.full_url, code, msg, hdrs, fp)
E       urllib.error.HTTPError: HTTP Error 503: Service Unavailable

/usr/share/miniconda/lib/python3.8/urllib/request.py:649: HTTPError
----------------------------- Captured stdout call -----------------------------
Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to tests/test_data/download/MNIST/raw/train-images-idx3-ubyte.gz
----------------------------- Captured stderr call -----------------------------



0it [00:00, ?it/s]
--------------------------- Captured stderr teardown ---------------------------

169009152it [00:08, 20945408.69it/s]                               

170500096it [00:15, 10919439.45it/s]                               
_________________________ test_get_train_test[MNISTM] __________________________

dataset_name = 'MNISTM', download_path = 'tests/test_data/download'

    @pytest.mark.parametrize("dataset_name", ALL)
    def test_get_train_test(dataset_name, download_path):
        source, target, num_channels = DigitDataset.get_source_target(
            DigitDataset(dataset_name), DigitDataset(dataset_name), download_path
        )
>       source_train = source.get_train()

tests/loaddata/test_digits_access.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
kale/loaddata/digits_access.py:99: in get_train
    return MNISTM(self._data_path, train=True, transform=self._transform, download=True)
kale/loaddata/mnistm.py:60: in __init__
    self.download()
kale/loaddata/mnistm.py:145: in download
    mnist_train_labels = datasets.MNIST(root=self.mnist_root, train=True, download=True).targets
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/mnist.py:79: in __init__
    self.download()
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/mnist.py:146: in download
    download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:256: in download_and_extract_archive
    download_url(url, download_root, filename, md5)
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:84: in download_url
    raise e
/usr/share/miniconda/lib/python3.8/site-packages/torchvision/datasets/utils.py:70: in download_url
    urllib.request.urlretrieve(
/usr/share/miniconda/lib/python3.8/urllib/request.py:247: in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
/usr/share/miniconda/lib/python3.8/urllib/request.py:222: in urlopen
    return opener.open(url, data, timeout)
/usr/share/miniconda/lib/python3.8/urllib/request.py:531: in open
    response = meth(req, response)
/usr/share/miniconda/lib/python3.8/urllib/request.py:640: in http_response
    response = self.parent.error(
/usr/share/miniconda/lib/python3.8/urllib/request.py:569: in error
    return self._call_chain(*args)
/usr/share/miniconda/lib/python3.8/urllib/request.py:502: in _call_chain
    result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib.request.HTTPDefaultErrorHandler object at 0x7fcefa33c1f0>
req = <urllib.request.Request object at 0x7fcf36bbfc40>
fp = <http.client.HTTPResponse object at 0x7fcf36bbf550>, code = 503
msg = 'Service Unavailable'
hdrs = <http.client.HTTPMessage object at 0x7fcf36bc9ca0>

    def http_error_default(self, req, fp, code, msg, hdrs):
>       raise HTTPError(req.full_url, code, msg, hdrs, fp)
E       urllib.error.HTTPError: HTTP Error 503: Service Unavailable

/usr/share/miniconda/lib/python3.8/urllib/request.py:649: HTTPError
----------------------------- Captured stdout call -----------------------------
Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to tests/test_data/download/MNIST/raw/train-images-idx3-ubyte.gz
----------------------------- Captured stderr call -----------------------------

Expected Behaviour

PR 122 test is expected to fail but PR 120 test is expected to pass.

Environment

GitHub actions.

Additional context

Is this due to conda?

ERROR collecting test session

πŸ› Bug

When I run the whole test suite receive this error: Error Collecting Test Session

To reproduce

pytest

** Stack trace/error message **

================================================================= ERRORS ==================================================================
______________________________________________________ ERROR collecting test session ______________________________________________________
../../opt/anaconda3/lib/python3.8/site-packages/_pytest/config/init.py:570: in _importconftest
mod = import_path(conftestpath, mode=importmode)
../../opt/anaconda3/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('tests.conftest', '/Users/kennedydike/Downloads/pykale-main/tests/conftest.py', PosixPath('/Users/kennedydike/Downloads/pykale-main/pykale/pykale/tests/conftest.py'))
========================================================= short test summary info =========================================================
ERROR - _pytest.pathlib.ImportPathMismatchError: ('tests.conftest', '/Users/kennedydike/Downloads/pykale-main/tests/conftest.py', Posix...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================ 1 error in 1.16s =============================================================

Expected Behaviour

I expected to see a pass or fail for each of the unit tests created in all the files in the folder.

Environment

PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 10.15.7 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.2)
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.8 (default, Apr 13 2021, 12:59:45) [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.15.7-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] numpydoc==1.1.0
[pip3] pytorch-lightning==1.3.8
[pip3] pytorch-memlab==0.2.3
[pip3] torch==1.9.0
[pip3] torchaudio==0.9.0a0+33b2469
[pip3] torchmetrics==0.4.1
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.10.0
[conda] blas 1.0 mkl
[conda] ffmpeg 4.3 h0a44026_0 pytorch
[conda] mkl 2021.2.0 hecd8cb5_269
[conda] mkl-service 2.3.0 py38h9ed2024_1
[conda] mkl_fft 1.3.0 py38h4a7008c_2
[conda] mkl_random 1.2.1 py38hb2f4e1b_2
[conda] numpy 1.20.1 py38hd6e1bb9_0
[conda] numpy-base 1.20.1 py38h585ceec_0
[conda] numpydoc 1.1.0 pyhd3eb1b0_1
[conda] pytorch 1.9.0 py3.8_0 pytorch
[conda] pytorch-lightning 1.3.8 pypi_0 pypi
[conda] pytorch-memlab 0.2.3 pypi_0 pypi
[conda] torch 1.9.0 pypi_0 pypi
[conda] torchaudio 0.9.0 py38 pytorch
[conda] torchmetrics 0.4.1 pypi_0 pypi
[conda] torchsummary 1.5.1 pypi_0 pypi
[conda] torchvision 0.10.0 pypi_0 pypi

Additional context

Add any other context about the problem here.

Exclude `examples/` from codecov

Tests from examples need to be considered on a "per-example" basis. Reporting coverage along with the main package is confusing.

Do we need to update Pytorch Lightning from v0.9.0 to v1.0.2

Bug

I meet the same bug as this issue when I want to use pl.metrics.Accuracy directly to evaluate my models. This bug has been fixed in the new version 1.0.2.

However, the new version has changed the method to generate the loss/accuracy logs. This is the warning message.
The {log:dict keyword} was deprecated in 0.9.1 and will be removed in 1.0.0.
Please use self.log(...) inside the lightningModule instead.
Log on a step or aggregate epoch metric to the logger and/or progress bar (inside LightningModule)
self.log('train_loss', loss, on_step=True, on_epoch=True, prog_bar=True)

If we decide to update, we need to update all the training_step, validation_step, testing_step with the new logging method.

[Bug] Installation on Mac

πŸ› Bug

To reproduce

Steps to reproduce the behavior:

  1. pip install pykale[extras]
  2. pip install .[extras]
  3. pip install -e .[dev]

** Stack trace/error message **

zsh: no matches found: .[extras]
zsh: no matches found: pykale[extras]
zsh: no matches found: .[dev]

Expected Behaviour

Environment

active environment : base
active env location : /opt/anaconda3
shell level : 2
user config file : /Users/liudaotan/.condarc
populated config files : /Users/liudaotan/.condarc
conda version : 4.9.2
conda-build version : 3.20.5
python version : 3.8.5.final.0
virtual packages : __osx=10.16=0
__unix=0=0
__archspec=1=x86_64
base environment : /opt/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /opt/anaconda3/pkgs
/Users/liudaotan/.conda/pkgs
envs directories : /opt/anaconda3/envs
/Users/liudaotan/.conda/envs
platform : osx-64
user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Darwin/20.3.0 OSX/10.16
UID:GID : 501:20
netrc file : None
offline mode : False

Please copy and paste the output from our
environment collection script
(or fill out the checklist below manually).

You can get the script and run it with:

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
  • PyTorch Version (e.g., 1.0): 1.7
  • OS (e.g., Linux): Mac (M1)
  • How you installed PyTorch (conda, pip, source): conda
  • Build command you used (if compiling from source):
  • Python version: 3.8
  • CUDA/cuDNN version: null
  • GPU models and configuration:
  • Any other relevant information:

Additional context

When I change the code as following , every thing goes well.

  1. pip install 'pykale[extras]'
  2. pip install '.[extras]'
  3. pip install '-e .[dev]'

Lightning Flash collaboration

πŸš€ Feature Request

Dear team behind pykale,

Awesome library, really neat initiative.
I am leading the PyTorch Lightning Team.
I believe there is lot of overlapping with Lightning Flash: https://github.com/PyTorchLightning/lightning-flash.

We wondered if you would be interested in some form of collaboration ?

Best,
T.C

Motivation

Is your feature request related to a problem? Please describe.

Pitch

Describe the solution you'd like

Describe alternatives you've considered

Are you willing to open a pull request? (We LOVE contributions!!!)

Additional context

[Bug] Complex number in MPCA eigenvalues/eigenvectors

πŸ› Complex number in MPCA eigenvalues/eigenvectors

To reproduce

In some cases, the eigen decompostion in MPCA can return complex eigenvalues and eignevectors.

>>> eig_values
Out[1]: 
array([ 2.03946400e+004+0.00000000e+00j,  8.53028325e+003+0.00000000e+00j,
        6.77832566e+003+0.00000000e+00j,  5.56850912e+003+0.00000000e+00j,
        4.14053054e+003+0.00000000e+00j,  3.85073231e+003+0.00000000e+00j,
        2.99306387e+003+0.00000000e+00j,  2.51583008e+003+0.00000000e+00j,
        2.07546552e+003+0.00000000e+00j,  1.72131535e+003+0.00000000e+00j,
        1.50710446e+003+0.00000000e+00j,  1.24574081e+003+0.00000000e+00j,
        1.06374939e+003+0.00000000e+00j,  8.82491750e+002+0.00000000e+00j,
        7.77560753e+002+0.00000000e+00j,  1.01041037e+002+0.00000000e+00j,
        6.41473082e+002+0.00000000e+00j,  5.66840523e+002+0.00000000e+00j,
        4.61197948e+002+0.00000000e+00j,  3.78630061e+002+0.00000000e+00j,
        2.13165912e+002+0.00000000e+00j,  2.55552782e+002+0.00000000e+00j,
        6.06324756e-013+0.00000000e+00j,  9.97100169e-015+0.00000000e+00j,
       -3.31739883e-016+0.00000000e+00j, -4.13037170e-022+0.00000000e+00j,
        7.86664595e-028+8.39380061e-27j,  7.86664595e-028-8.39380061e-27j,
        3.67760555e-027+4.43588239e-27j,  3.67760555e-027-4.43588239e-27j,
        5.10824776e-027+0.00000000e+00j, -4.05596311e-027+2.34425407e-27j,
       -4.05596311e-027-2.34425407e-27j, -1.58477788e-027+3.16041573e-27j,
       -1.58477788e-027-3.16041573e-27j, -3.58807233e-027+0.00000000e+00j,
        2.27118464e-027+1.39384460e-27j,  2.27118464e-027-1.39384460e-27j,
        9.98017692e-028+6.54044843e-28j,  9.98017692e-028-6.54044843e-28j,
       -1.27894122e-027+7.45212435e-28j, -1.27894122e-027-7.45212435e-28j,
       -8.19860299e-028+0.00000000e+00j,  4.44355796e-029+0.00000000e+00j,
       -4.33625284e-045+1.20085059e-44j, -4.33625284e-045-1.20085059e-44j,
       -1.96760884e-062+0.00000000e+00j, -3.83573351e-060+0.00000000e+00j,
        1.01157335e-076+0.00000000e+00j,  1.83716727e-091+0.00000000e+00j,
       -9.60847167e-092+0.00000000e+00j, -2.32451013e-092+0.00000000e+00j,
        7.71193314e-106+0.00000000e+00j, -1.86756379e-107+0.00000000e+00j,
       -4.61915882e-122+0.00000000e+00j, -1.13689708e-121+0.00000000e+00j,
        1.84293425e-138+0.00000000e+00j, -1.44155321e-137+0.00000000e+00j,
       -1.29151358e-152+0.00000000e+00j,  1.94857963e-155+0.00000000e+00j,
        4.47153100e-183+0.00000000e+00j,  1.06315569e-168+0.00000000e+00j,
        0.00000000e+000+0.00000000e+00j, -1.54240939e-199+0.00000000e+00j])
>>> eig_values.dtype
Out[2]: dtype('complex128')

Expected Behaviour

In MPCA, we decompose the sum of covariance matrices for each mode. Because covaricance matrix is positive definite real symmetric, and therefore the sum of covariance matrices is a positive definite real symmetric matrix. The eigenvalues should be real and non-negative. This may be an python numerical error or the a problem of numpy eig function (ref: https://stackoverflow.com/questions/8765310/scipy-linalg-eig-return-complex-eigenvalues-for-covariance-matrix).

So my question is, can we simply take the real part and ignore the complex part? Alternatively, can we use SVD to obatin eigenvalues and eigenvectors. I have tried the SVD implemented in Scipy for the same case, and no complex numbers returned.

SVD singular values for the same input

array([2.03946400e+04, 8.53028325e+03, 6.77832566e+03, 5.56850912e+03,
       4.14053054e+03, 3.85073231e+03, 2.99306387e+03, 2.51583008e+03,
       2.07546552e+03, 1.72131535e+03, 1.50710446e+03, 1.24574081e+03,
       1.06374939e+03, 8.82491750e+02, 7.77560753e+02, 6.41473082e+02,
       5.66840523e+02, 4.61197948e+02, 3.78630061e+02, 2.55552782e+02,
       2.13165912e+02, 1.01041037e+02, 9.60507019e-12, 4.23097888e-12,
       3.72814677e-12, 2.92081445e-12, 2.24098733e-12, 1.39518126e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 1.34449963e-12, 1.34449963e-12, 1.34449963e-12,
       1.34449963e-12, 8.90409683e-13, 4.51888166e-13, 4.00569300e-13])

Environment

Windows 10 OS

[pip3] numpy==1.19.2
[pip3] numpydoc==1.1.0
[pip3] pytorch-lightning==0.8.5
[pip3] torch==1.7.1
[pip3] torchaudio==0.7.2
[pip3] torchvision==0.8.2
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               10.1.243             h74a9793_0
[conda] mkl                       2020.2                      256
[conda] mkl-service               2.3.0            py37h196d8e1_0
[conda] mkl_fft                   1.2.1            py37h46781fe_0
[conda] mkl_random                1.1.1            py37h47e9c7a_0
[conda] numpy                     1.19.2           py37hadc3359_0
[conda] numpy-base                1.19.2           py37ha3acd2a_0
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1
[conda] pytorch                   1.7.1           py3.7_cuda101_cudnn7_0    pytorch
[conda] pytorch-lightning         0.8.5                    pypi_0    pypi
[conda] torchaudio                0.7.2                      py37    pytorch
[conda] torchvision               0.8.2                py37_cu101    pytorch

[Bug] Digits notebook - digits access

πŸ› Bug

Possible break due to PR #210 changes in digits access API.

To reproduce

Run https://colab.research.google.com/github/pykale/pykale/blob/main/examples/digits_dann_lightn/tutorial.ipynb#scrollTo=237L9WPwrl2t and there will be an error when training the model

%time trainer.fit(model)
results.update(
    is_validation=True, method_name=cfg.DAN.METHOD, seed=seed, metric_values=trainer.callback_metrics,
)

** Stack trace/error message **


  | Name              | Type                | Params
----------------------------------------------------------
0 | feat              | SmallCNNFeature     | 312 K 
1 | classifier        | ClassNetSmallImage  | 24.4 K
2 | domain_classifier | DomainNetSmallImage | 128 K 
----------------------------------------------------------
466 K     Trainable params
0         Non-trainable params
466 K     Total params
1.864     Total estimated model params size (MB)
Validation sanity check: 0%
0/2 [00:00<?, ?it/s]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-30-c69caaf3d927> in <module>()
----> 1 get_ipython().magic('time trainer.fit(model)')
      2 results.update(
      3     is_validation=True, method_name=cfg.DAN.METHOD, seed=seed, metric_values=trainer.callback_metrics,
      4 )

26 frames
<decorator-gen-53> in time(self, line, cell, local_ns)

<timed eval> in <module>()

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py in _conv_forward(self, input, weight, bias)
    438                             _pair(0), self.dilation, self.groups)
    439         return F.conv2d(input, weight, bias, self.stride,
--> 440                         self.padding, self.dilation, self.groups)
    441 
    442     def forward(self, input: Tensor) -> Tensor:

RuntimeError: Given groups=1, weight of size [64, 3, 5, 5], expected input[150, 1, 32, 32] to have 3 channels, but got 1 channels instead

[Refactor] Unique API for image access

Merge digit_access, get_dicom, image_access, and cifa_access to a single access for images.

  • `kale.loaddata.digits_access`, `kale.loaddata.get_dicom`, `kale.loaddata.image_access`
  • Only one API under `kale.loaddata` for Loading image datasets.
  • Breaking changes. All image-related data loading will be affected.

[Bug] Pytest Fixutre not Found Error

πŸ› Bug

When I make the idx_to_class function a pytest fixture, an error occurs saying 'idx' fixture not found. 'idx' is the input parameter to the function and as such I do not know why this error keeps occurring. The code runs properly when I do not make the idx_to_class function a pytest fixture but the pytest fixture would make the code to be more in a pytest style.

To reproduce

This is the edited code from #189 which needed changes. The updated version which produced the error is in my forked repository at https://github.com/kennedy12335/pykale/blob/main/tests/loaddata/test_sampler.py.

code snippet to reproduce the behaviour:

pytest tests/loaddata/test_sampler.py -v

** Stack trace/error message **

______________________________________________________ ERROR at setup of test_balanced_small_batches _______________________________________________________
file /Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py, line 24
  def test_balanced_small_batches(idx_to_class):
file /Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py, line 14
  @pytest.fixture(scope = "module")
  def idx_to_class(idx):
E       fixture 'idx' not found
>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, download_path, gait, idx_to_class, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py:14
______________________________________________________ ERROR at setup of test_balanced_bigger_batches ______________________________________________________
file /Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py, line 45
  def test_balanced_bigger_batches(idx_to_class):
file /Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py, line 14
  @pytest.fixture(scope = "module")
  def idx_to_class(idx):
E       fixture 'idx' not found
>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, download_path, gait, idx_to_class, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/Users/kennedydike/Documents/GitHub/pykale/tests/loaddata/test_sampler.py:14

Expected Behaviour

No error expected and a pass/fail outcome for each test

Environment

PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 10.15.7 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.2)
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.8 (default, Apr 13 2021, 12:59:45) [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.15.7-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] numpydoc==1.1.0
[pip3] pytorch-lightning==1.3.8
[pip3] pytorch-memlab==0.2.3
[pip3] torch==1.9.0
[pip3] torch-cluster==1.5.9
[pip3] torch-geometric==1.7.2
[pip3] torch-scatter==2.0.7
[pip3] torch-sparse==0.6.10
[pip3] torch-spline-conv==1.2.1
[pip3] torchaudio==0.9.0a0+33b2469
[pip3] torchmetrics==0.4.1
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.10.0
[conda] blas 1.0 mkl
[conda] ffmpeg 4.3 h0a44026_0 pytorch
[conda] mkl 2021.2.0 hecd8cb5_269
[conda] mkl-service 2.3.0 py38h9ed2024_1
[conda] mkl_fft 1.3.0 py38h4a7008c_2
[conda] mkl_random 1.2.1 py38hb2f4e1b_2
[conda] numpy 1.20.1 py38hd6e1bb9_0
[conda] numpy-base 1.20.1 py38h585ceec_0
[conda] numpydoc 1.1.0 pyhd3eb1b0_1
[conda] pytorch 1.9.0 py3.8_0 pytorch
[conda] pytorch-cluster 1.5.9 py38_torch_1.9.0_cpu rusty1s
[conda] pytorch-geometric 1.7.2 py38_torch_1.9.0_cpu rusty1s
[conda] pytorch-lightning 1.3.8 pypi_0 pypi
[conda] pytorch-memlab 0.2.3 pypi_0 pypi
[conda] pytorch-scatter 2.0.7 py38_torch_1.9.0_cpu rusty1s
[conda] pytorch-sparse 0.6.10 py38_torch_1.9.0_cpu rusty1s
[conda] pytorch-spline-conv 1.2.1 py38_torch_1.9.0_cpu rusty1s
[conda] torch 1.9.0 pypi_0 pypi
[conda] torchaudio 0.9.0 py38 pytorch
[conda] torchmetrics 0.4.1 pypi_0 pypi
[conda] torchsummary 1.5.1 pypi_0 pypi
[conda] torchvision 0.10.0 pypi_0 pypi

Additional context

I am attempting to rewrite #189 in a more pytest style so any suggested changes would be appreciated

Unnecessary `kale.embed.video_cnn`

To me, kale.embed.video_cnn is not necessary just for two algorithms. This introduces unnecessary depth to the API. It will be needed only if embed becomes too big in future. Change it to something like video_i3d or video_res3d will be more compact and convenient to use.

[Bug] add library "tqdm" to install dependencies

Haiping,
Could you please add the pip library tqdm to the install dependencies.

This will prevent an issue when people try to run the video loader example. Unfortunately, when tqdm is not installed and one attempts to use it, it does not give a clear error such as tqdm is not installed. Instead, it gives a cryptic error message that does not make it clear what the problem is.

[Bug] `test_deep_dta` fails

πŸ› Bug

test_deep_data fails

To reproduce

Steps to reproduce the behavior:

  1. pytest .\tests\pipeline\test_deep_dti.py

** Stack trace/error message **

============================================================================ test session starts =============================================================================
platform win32 -- Python 3.7.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\bobturner\Documents\pykale
collected 1 item

tests\pipeline\test_deep_dti.py F                                                                                                                                       [100%]

================================================================================== FAILURES ==================================================================================
_______________________________________________________________________________ test_deep_data _______________________________________________________________________________

download_path = 'tests\\test_data'

    def test_deep_data(download_path):
        test_dataset = BindingDBDataset(name=DATASET, split="test", path=download_path)
        test_batch = next(iter(DataLoader(dataset=test_dataset, shuffle=True, batch_size=32)))

        drug_encoder = CNNEncoder(num_embeddings=64, embedding_dim=128, sequence_length=85, num_kernels=32, kernel_length=8)
        target_encoder = CNNEncoder(
            num_embeddings=25, embedding_dim=128, sequence_length=1200, num_kernels=32, kernel_length=8
        )
        decoder = MLPDecoder(in_dim=192, hidden_dim=16, out_dim=16)
        # test deep_dta trainer
        save_parameters = {"seed": 2020, "batch_size": 256}
        model = DeepDTATrainer(drug_encoder, target_encoder, decoder, lr=0.001, ci_metric=True, **save_parameters).eval()
        assert isinstance(model.drug_encoder, CNNEncoder)
        assert isinstance(model.target_encoder, CNNEncoder)
        assert isinstance(model.decoder, MLPDecoder)
        model.configure_optimizers()
>       assert torch.is_tensor(model.validation_step(test_batch, 0))

tests\pipeline\test_deep_dti.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
kale\pipeline\deep_dti.py:115: in validation_step
    self.log("val_ci", ci, on_epoch=True, on_step=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

self = DeepDTATrainer(
  (drug_encoder): CNNEncoder(
    (embedding): Embedding(65, 128)
    (conv1): Conv1d(85, 32, kernel_s...s=True)
    (fc4): Linear(in_features=16, out_features=1, bias=True)
    (dropout): Dropout(p=0.1, inplace=False)
  )
)
name = 'val_ci', value = tensor([0.4316]), prog_bar = False, logger = True, on_step = False, on_epoch = True, reduce_fx = 'mean', tbptt_reduce_fx = None
tbptt_pad_token = None, enable_graph = False, sync_dist = False, sync_dist_op = None, sync_dist_group = None, add_dataloader_idx = True, batch_size = None
metric_attribute = None, rank_zero_only = None

    def log(
        self,
        name: str,
        value: _METRIC_COLLECTION,
        prog_bar: bool = False,
        logger: bool = True,
        on_step: Optional[bool] = None,
        on_epoch: Optional[bool] = None,
        reduce_fx: Union[str, Callable] = "default",  # TODO: change to 'mean' when `sync_dist_op` is removed in 1.6
        tbptt_reduce_fx: Optional = None,  # noqa: Remove in 1.6
        tbptt_pad_token: Optional = None,  # noqa: Remove in 1.6
        enable_graph: bool = False,
        sync_dist: bool = False,
        sync_dist_op: Optional = None,  # noqa: Remove in 1.6
        sync_dist_group: Optional[Any] = None,
        add_dataloader_idx: bool = True,
        batch_size: Optional[int] = None,
        metric_attribute: Optional[str] = None,
        rank_zero_only: Optional[bool] = None,
    ) -> None:
        """
        Log a key, value pair.

        Example::

            self.log('train_loss', loss)

        The default behavior per hook is as follows:

        .. csv-table:: ``*`` also applies to the test loop
           :header: "LightningModule Hook", "on_step", "on_epoch", "prog_bar", "logger"
           :widths: 20, 10, 10, 10, 10

           "training_step", "T", "F", "F", "T"
           "training_step_end", "T", "F", "F", "T"
           "training_epoch_end", "F", "T", "F", "T"
           "validation_step*", "F", "T", "F", "T"
           "validation_step_end*", "F", "T", "F", "T"
           "validation_epoch_end*", "F", "T", "F", "T"

        Args:
            name: key to log
            value: value to log. Can be a ``float``, ``Tensor``, ``Metric``, or a dictionary of the former.
            prog_bar: if True logs to the progress bar
            logger: if True logs to the logger
            on_step: if True logs at this step. None auto-logs at the training_step but not validation/test_step
            on_epoch: if True logs epoch accumulated metrics. None auto-logs at the val/test step but not training_step
            reduce_fx: reduction function over step values for end of epoch. :meth:`torch.mean` by default.
            enable_graph: if True, will not auto detach the graph
            sync_dist: if True, reduces the metric across GPUs/TPUs
            sync_dist_group: the ddp group to sync across
            add_dataloader_idx: if True, appends the index of the current dataloader to
                the name (when using multiple). If False, user needs to give unique names for
                each dataloader to not mix values
            batch_size: Current batch_size. This will be directly inferred from the loaded batch,
                but some data structures might need to explicitly provide it.
            metric_attribute: To restore the metric state, Lightning requires the reference of the
                :class:`torchmetrics.Metric` in your model. This is found automatically if it is a model attribute.
            rank_zero_only: Whether the value will be logged only on rank 0. This will prevent synchronization which
                would produce a deadlock as not all processes would perform this log call.
        """
        if tbptt_reduce_fx is not None:
            rank_zero_deprecation(
                "`self.log(tbptt_reduce_fx=...)` is no longer supported. The flag will be removed in v1.6."
                " Please, open a discussion explaining your use-case in"
                " `https://github.com/PyTorchLightning/pytorch-lightning/discussions`"
            )
        if tbptt_pad_token is not None:
            rank_zero_deprecation(
                "`self.log(tbptt_pad_token=...)` is no longer supported. The flag will be removed in v1.6."
                " Please, open a discussion explaining your use-case in"
                " `https://github.com/PyTorchLightning/pytorch-lightning/discussions`"
            )
        if sync_dist_op is not None:
            rank_zero_deprecation(
                f"`self.log(sync_dist_op='{sync_dist_op}')` is deprecated and will be removed in v.1.6."
                f" Use `self.log(reduce_fx={sync_dist_op})` instead."
            )
            if reduce_fx == "default":
                reduce_fx = sync_dist_op
        elif reduce_fx == "default":
            reduce_fx = "mean"

        # check for invalid values
        apply_to_collection(value, dict, self.__check_not_nested, name)
        apply_to_collection(
            value, object, self.__check_allowed, name, value, wrong_dtype=(numbers.Number, Metric, Tensor, dict)
        )

        # set the default depending on the fx_name
        on_step = self.__auto_choose_log_on_step(on_step)
        on_epoch = self.__auto_choose_log_on_epoch(on_epoch)

>       results = self.trainer._results
E       AttributeError: 'NoneType' object has no attribute '_results'

..\..\.conda\envs\bindingdb\lib\site-packages\pytorch_lightning\core\lightning.py:407: AttributeError
---------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------- 
Found local copy...
Loading...
Done!
To log space...
========================================================================== short test summary info =========================================================================== 
FAILED tests/pipeline/test_deep_dti.py::test_deep_data - AttributeError: 'NoneType' object has no attribute '_results'
============================================================================= 1 failed in 3.50s ============================================================================== 

Expected Behaviour

Test passes.

Environment

PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: (tdm64-1) 9.2.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 15:37:01) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19041-SP0
Is CUDA available: False
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: GeForce GTX 1050 Ti with Max-Q Design
Nvidia driver version: 462.31
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64_7.dll
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.1
[pip3] pytorch-lightning==1.4.0
[pip3] pytorch-memlab==0.2.3
[pip3] torch==1.9.0
[pip3] torch-cluster==1.5.9
[pip3] torch-geometric==1.7.2
[pip3] torch-scatter==2.0.8
[pip3] torch-sparse==0.6.10
[pip3] torch-spline-conv==1.2.1
[pip3] torchaudio==0.9.0
[pip3] torchmetrics==0.4.1
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.10.0
[conda] blas                      2.110                       mkl    conda-forge
[conda] blas-devel                3.9.0                    10_mkl    conda-forge
[conda] cpuonly                   1.0                           0    pytorch
[conda] libblas                   3.9.0                    10_mkl    conda-forge
[conda] libcblas                  3.9.0                    10_mkl    conda-forge
[conda] liblapack                 3.9.0                    10_mkl    conda-forge
[conda] liblapacke                3.9.0                    10_mkl    conda-forge
[conda] mkl                       2021.3.0           hb70f87d_564    conda-forge
[conda] mkl-devel                 2021.3.0           h57928b3_565    conda-forge
[conda] mkl-include               2021.3.0           hb70f87d_564    conda-forge
[conda] numpy                     1.21.1           py37hcbcd69c_0    conda-forge
[conda] pytorch                   1.9.0               py3.7_cpu_0  [cpuonly]  pytorch
[conda] pytorch-cluster           1.5.9           py37_torch_1.9.0_cpu    rusty1s
[conda] pytorch-geometric         1.7.2           py37_torch_1.9.0_cpu    rusty1s
[conda] pytorch-lightning         1.4.0                    pypi_0    pypi
[conda] pytorch-memlab            0.2.3                    pypi_0    pypi
[conda] pytorch-scatter           2.0.8           py37_torch_1.9.0_cpu    rusty1s
[conda] pytorch-sparse            0.6.10          py37_torch_1.9.0_cpu    rusty1s
[conda] pytorch-spline-conv       1.2.1           py37_torch_1.9.0_cpu    rusty1s
[conda] torchaudio                0.9.0                      py37    pytorch
[conda] torchmetrics              0.4.1                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.10.0                 py37_cpu  [cpuonly]  pytorch

Seems that there are also problems with CI runs on Ubuntu where environment is more tightly controlled.

Docs on YAML

More docs on use of .yaml may be helpful to users. Put in Example Docs (Pointer).

[Feature Request] Tests for notebooks

πŸš€ Feature Request

Add basic tests for the tutorial notebooks.

Motivation

Changes to dependencies can cause notebooks to fail unexpectedly.

Pitch

Using GitHub actions, these should:

  • Set up an appropriate execution environment
  • Convert the notebook to a script
  • Run the script
  • Report failure if there is an error

Describe alternatives you've considered

Regression tests would be very time consuming.

Are you willing to open a pull request? Yes

[Bug] Typo in running the cmri_mpca from terminal

πŸ› Bug

To reproduce

Steps to reproduce the behavior:

  1. Get the repository
  2. Try to run from Anaconda Prompt the "pyakele/examples/cmri_mpca" using the command shown on git (python main.py --cfg configs/turorial_svc.yaml) (the word tutorial is misspelled) and the command should be:
    python main.py --cfg configs/tutorial_svc.yaml

How to install

Make sure it works!

Remove torch-cluster? (and put it documentation that you only need it for torch-geometric).

[Refactor] Pytorch Lightning for Future Examples

A clear and concise description of what you wish to refactor

I propose that for any future examples we create where we train a model, we always use Pytorch Lightning. Lightning's structure is super clean and understandable and leaves out huge amounts of boilerplate code. This boilerplate code makes it much harder for users to find the lines of code they really care about. I think lightning is important because it forces each of us to create very minimal and clean examples.

I think if we don't do this, we will have a problem in the future where all of our examples/tutorials are too messy.
This is because right now we are all writing our training systems in very different ways. Sometimes cleaner, sometimes messier, and different every time.

It would be good if every examples follows the same uniform code structure. This way it will be very easy for users to learn about the different examples because they spend minimal time understanding unimportant technical code. It would be easier for users to learn about pykale through our examples like this.

Besides, after not using it for the past 6 months, I've started using lightning again now and it is absolutely amazing 😁.

Modules that will be modified

Future examples

Impact on code structure

All examples that train models will have a uniform structure

Impact on speed

None

Will this be a breaking change

No because this only affects examples and nothing depends on examples

Notes

Let me know if I did something wrong in the labeling or organizing of this issue. Also, we can discuss this issue in the next meeting.

Running Test Files

Discussed in #180

Originally posted by kennedy12335 July 13, 2021
I am currently trying to run the test_csv_logger.py file and I am encountering an error. It cannot locate files from the folder containing the test data. I believe the test data is downloaded automatically from the confest.py script and I assume that is when the test_data folder would be created. I may be wrong but that was what I understood from https://github.com/pykale/pykale/blob/main/tests/README.md. Can someone please explain why I am getting errors. To be precise this is the error I am getting:

_E FileNotFoundError: [Errno 2] No such file or directory: 'tests/test_data/parameters.json'

kale/utils/csv_logger.py:66: FileNotFoundError_

[Bug installing Pykale - missing "kale.loaddata.image_access"

πŸ› Bug in installing Pykale

To reproduce

Steps to reproduce the behavior:

  1. Install PyKale in a new environment
  2. Install the PyKale Git Repository
  3. Try to run the "python main.py --cfg configs/tutorial_svc.yaml" (typo corrected in previous bug report)
  4. Will display an error: kale.loaddata.image_access does not exist
  5. Go into the place where the environment is set-up, in my case: C:\Users\vcrac\anaconda3\envs\torch\Lib\site-packages\kale\loaddata and find out that "image_access.py" is missing.

Quick fix of the problem:

1.Create in the "..\Lib\site-packages\kale\loaddata" a file named "image_access.py" and paste the code cade is available on git (https://github.com/pykale/pykale/tree/main/kale/loaddata/image_access/py)
image_example_image_access

Long fix:

  1. I am not sure how to check/ modify the packages that are on the pip pykale in order for "image_access.py" to be included when using "pip install pykale"

[Bug] DeepDTA

πŸ› Bug

PyG error when using GPU in notebook. (No problem when using CPU).

To reproduce

Steps to reproduce the behavior:

Run https://colab.research.google.com/github/pykale/pykale/blob/main/examples/bindingdb_deepdta/tutorial.ipynb using GPU

** Stack trace/error message **

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-6-579077adba8e> in <module>()
      2 import torch
      3 from config import get_cfg_defaults
----> 4 from model import get_model
      5 from pytorch_lightning.callbacks import ModelCheckpoint
      6 from pytorch_lightning.loggers import TensorBoardLogger

8 frames
/content/pykale/examples/bindingdb_deepdta/pykale/examples/bindingdb_deepdta/pykale/examples/bindingdb_deepdta/model.py in <module>()
----> 1 from kale.embed.seq_nn import CNNEncoder
      2 from kale.pipeline.deep_dti import DeepDTATrainer
      3 from kale.predict.decode import MLPDecoder
      4 
      5 

/usr/local/lib/python3.7/dist-packages/kale/embed/seq_nn.py in <module>()
      5 import torch.nn as nn
      6 import torch.nn.functional as F
----> 7 from torch_geometric.nn import GCNConv, global_max_pool
      8 
      9 

/usr/local/lib/python3.7/dist-packages/torch_geometric/__init__.py in <module>()
      5 from .debug import is_debug_enabled, debug, set_debug
      6 
----> 7 import torch_geometric.data
      8 import torch_geometric.loader
      9 import torch_geometric.transforms

/usr/local/lib/python3.7/dist-packages/torch_geometric/data/__init__.py in <module>()
----> 1 from .data import Data
      2 from .hetero_data import HeteroData
      3 from .temporal import TemporalData
      4 from .batch import Batch
      5 from .dataset import Dataset

/usr/local/lib/python3.7/dist-packages/torch_geometric/data/data.py in <module>()
      1 from typing import (Optional, Dict, Any, Union, List, Iterable, Tuple,
      2                     NamedTuple, Callable)
----> 3 from torch_geometric.typing import OptTensor
      4 from torch_geometric.deprecation import deprecated
      5 

/usr/local/lib/python3.7/dist-packages/torch_geometric/typing.py in <module>()
      2 
      3 from torch import Tensor
----> 4 from torch_sparse import SparseTensor
      5 
      6 # Types for accessing data ####################################################

/usr/local/lib/python3.7/dist-packages/torch_sparse/__init__.py in <module>()
     14 ]:
     15     torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
---> 16         f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
     17 
     18 if torch.cuda.is_available():  # pragma: no cover

/usr/local/lib/python3.7/dist-packages/torch/_ops.py in load_library(self, path)
    102             # static (global) initialization code in order to register custom
    103             # operators with the JIT.
--> 104             ctypes.CDLL(path)
    105         self.loaded_libraries.add(path)
    106 

/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory

[Bug] Running Test Files. Cannot Locate Test Data

πŸ› Bug

When running the test_csv_logger.py file, it is unable to locate the test data folder which contains the relevant test files.

To reproduce

pytest tests/utils/test_csv_logger.py -v

** Stack trace/error message **

E           FileNotFoundError: [Errno 2] No such file or directory: 'tests/test_data/parameters.json'

kale/utils/csv_logger.py:66: FileNotFoundError```

## Expected Behaviour

I expected the csv_logger test to pass and for the script to be able to access the test data.

## Environment

PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 10.15.7 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.2)
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.8 (default, Apr 13 2021, 12:59:45)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.15.7-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] numpydoc==1.1.0
[pip3] pytorch-lightning==1.3.8
[pip3] pytorch-memlab==0.2.3
[pip3] torch==1.9.0
[pip3] torchaudio==0.9.0a0+33b2469
[pip3] torchmetrics==0.4.1
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.10.0
[conda] blas                      1.0                         mkl  
[conda] ffmpeg                    4.3                  h0a44026_0    pytorch
[conda] mkl                       2021.2.0           hecd8cb5_269  
[conda] mkl-service               2.3.0            py38h9ed2024_1  
[conda] mkl_fft                   1.3.0            py38h4a7008c_2  
[conda] mkl_random                1.2.1            py38hb2f4e1b_2  
[conda] numpy                     1.20.1           py38hd6e1bb9_0  
[conda] numpy-base                1.20.1           py38h585ceec_0  
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1  
[conda] pytorch                   1.9.0                   py3.8_0    pytorch
[conda] pytorch-lightning         1.3.8                    pypi_0    pypi
[conda] pytorch-memlab            0.2.3                    pypi_0    pypi
[conda] torch                     1.9.0                    pypi_0    pypi
[conda] torchaudio                0.9.0                      py38    pytorch
[conda] torchmetrics              0.4.1                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.10.0                   pypi_0    pypi

## Additional context
Add any other context about the problem here.

Easier dependency management

  • Shall we make .extras default installations to simplify?
  • Regular (e.g. weekly) tests to detect problems with dependencies, updated libraries causing failure.

[Bug]

πŸ› Bug

TypeError: summary() got an unexpected keyword argument 'depth'

To reproduce

In pykale.examples.cifar_cnntransformer.main.py: model_stats = summary(net, (3, 32, 32), depth=10). When the parameter 'depth' exits, the code will return the error above. When deleting it, the program runs normally.

model_stats = summary(net, (3, 32, 32), depth=10)

** Stack trace/error message **

TypeError: summary() got an unexpected keyword argument 'depth'

Environment

[pip3] numpy==1.19.0
[pip3] pytorch-lightning==1.1.3
[pip3] torch==1.7.1
[pip3] torchsummary==1.5
[pip3] torchvision==0.4.1
[conda] blas 1.0
[conda] cudatoolkit 11.0.221
[conda] mkl 2020.2
[conda] mkl-service 2.3.0
[conda] mkl_fft 1.2.0
[conda] mkl_random 1.1.1
[conda] numpy 1.19.2
[conda] numpy-base 1.19.2
[conda] numpydoc 1.1.0
[conda] pytorch 1.7.0
[conda] torchvision 0.8.1

Process finished with exit code 0

[Feature Request] Video access for pandas=>1.3.0

πŸš€ Feature Request

Shift to pandas=>1.3.0 in setup.py and reduce the number of tests for video related modules.

Motivation

Errors in #175 due to pandas compatibility

Pitch

The follow error should be fixed for pandas 1.3.0

tests/loaddata/test_video_access.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
kale/loaddata/video_access.py:254: in get_train
    n_classes=self._n_classes,
kale/loaddata/video_datasets.py:120: in __init__
    test_mode,
kale/loaddata/videos.py:149: in __init__
    self._parse_list()
kale/loaddata/video_datasets.py:124: in _parse_list
    self.video_list = [VideoRecord(x, self.img_path) for x in list(self.make_dataset())]
kale/loaddata/video_datasets.py:146: in make_dataset
    input_file = pickle.load(input_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __cinit__() takes at least 2 positional arguments (0 given)

pandas/_libs/internals.pyx:572: TypeError

Additional context

[Qustion] python main.py --cfg configs/IC50-DeepDTA.yaml

πŸ› Bug

To reproduce

Steps to reproduce the behavior:

  1. Install PyTorch
  2. Install PyTorch Geometric
  3. git clone https://github.com/pykale/pykale
  4. cd pykale
  5. pip install .
  6. Β·Β·Β·Β·(all instructions step by step)
  7. conda install -c conda-forge rdkit
  8. pip install PyTDC
  9. python main.py --cfg configs/IC50-DeepDTA.yaml

** Stack trace/error message **

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    from model import get_model
  File "/Users/awei/Downloads/pykale/examples/bindingdb_deepdta/model.py", line 1, in <module>
    from kale.embed.seq_nn import CNNEncoder
  File "/Users/awei/Downloads/pykale/kale/embed/seq_nn.py", line 7, in <module>
    from torch_geometric.nn import GCNConv, global_max_pool
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_geometric/__init__.py", line 2, in <module>
    import torch_geometric.nn
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_geometric/nn/__init__.py", line 2, in <module>
    from .data_parallel import DataParallel
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_geometric/nn/data_parallel.py", line 5, in <module>
    from torch_geometric.data import Batch
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
    from .data import Data
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_geometric/data/data.py", line 8, in <module>
    from torch_sparse import coalesce, SparseTensor
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_sparse/__init__.py", line 2, in <module>
    from .coalesce import coalesce
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_sparse/coalesce.py", line 2, in <module>
    import torch_scatter
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_scatter/__init__.py", line 14, in <module>
    f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch/_ops.py", line 104, in load_library
    ctypes.CDLL(path)
  File "/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_scatter/_scatter_cpu.so, 6): Symbol not found: __ZNK3c104Type14isSubtypeOfExtENSt3__110shared_ptrIS0_EEPNS1_13basic_ostreamIcNS1_11char_traitsIcEEEE
  Referenced from: /Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_scatter/_scatter_cpu.so
  Expected in: /Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch/lib/libtorch_cpu.dylib
 in /Users/awei/opt/anaconda3/envs/pykale/lib/python3.6/site-packages/torch_scatter/_scatter_cpu.so

Expected Behaviour

Environment

active environment : pykale
active env location : /Users/awei/opt/anaconda3/envs/pykale
shell level : 1
user config file : /Users/awei/.condarc
populated config files : /Users/awei/.condarc
conda version : 4.9.2
conda-build version : 3.18.11
python version : 3.8.3.final.0
virtual packages : __osx=10.16=0
__unix=0=0
__archspec=1=x86_64
base environment : /Users/awei/opt/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/awei/opt/anaconda3/pkgs
/Users/awei/.conda/pkgs
envs directories : /Users/awei/opt/anaconda3/envs
/Users/awei/.conda/envs
platform : osx-64
user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.3 Darwin/20.3.0 OSX/10.16
UID:GID : 501:20
netrc file : None
offline mode : False


 - PyTorch Version (e.g., 1.0):  1.8.0
 - OS (e.g., Linux): mac
 - How you installed PyTorch (`conda`, `pip`, source): pip and conda (I have tried both)
 - Build command you used (if compiling from source):
 - Python version: 3.6.13
 - CUDA/cuDNN version: null
 - GPU models and configuration: null
 - Any other relevant information: 

## Additional context

torch-cluster             1.5.9                    pypi_0    pypi
torch-geometric           1.6.3                 pypi_0    pypi
torch-scatter             2.0.6                    pypi_0    pypi
torch-sparse            0.4.4                     pypi_0    pypi

[Bug] DAN loss may be below 0

πŸ› Bug

When I run DAN on digits_dann_lightn and action_dann_lightn, MMD loss T_mmd has some values below 0. It will cause T_total_loss below 0 because T_total_loss = T_task_loss + 1 * T_mmd. Is it correct?

To reproduce

Steps to reproduce the behavior:

In digits_dann_lightn,

  1. After merging #53, set fast_dev_run=False and logger=True in main.py.
  2. Run python main.py --cfg ./configs/MN2UP-DAN.yaml --gpus 1.
  3. Check the loss by printing them or tensorboard.

** Stack trace/error message **
This is my output with repeats=10, epoch=100, init_epoch=20.
The T_mmd varies, so does T_total_loss. I think the loss should be above 0.

image

Expected Behaviour

The loss should be above 0 like CDAN.
image

There are some useful links.
ADA code
Xlearn code
I checked these codes and ours is almost similar to them. Thus, I am not sure whether this loss output is right.

Environment

[pip3] numpy==1.19.2
[pip3] pytorch-lightning==1.0.3
[pip3] pytorch-memlab==0.2.2
[pip3] torch==1.7.0
[pip3] torchaudio==0.7.0
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.8.1
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               10.2.89              h74a9793_1
[conda] mkl                       2020.2                      256
[conda] mkl-service               2.3.0            py38hb782905_0
[conda] mkl_fft                   1.2.0            py38h45dec08_0
[conda] mkl_random                1.1.1            py38h47e9c7a_0
[conda] numpy                     1.19.2           py38hadc3359_0
[conda] numpy-base                1.19.2           py38ha3acd2a_0
[conda] pytorch                   1.7.0           py3.8_cuda102_cudnn7_0    pytorch
[conda] pytorch-lightning         1.0.2                    pypi_0    pypi
[conda] pytorch-memlab            0.2.2                    pypi_0    pypi
[conda] torchaudio                0.7.0                      py38    pytorch
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.8.1                py38_cu102    pytorch

Dependencies are not resolved correctly when running the digits example on Google colab.

πŸ› Bug

Dependencies are not resolved correctly when running the digits example on Google colab. Notebook otherwise runs fine.

To reproduce

Steps to reproduce the behavior:

  1. Navigate to https://colab.research.google.com/github/pykale/pykale/blob/main/examples/digits_dann_lightn/tutorial.ipynb and follow instructions in the notebook.

Or, code snippet to reproduce the behaviour

** Stack trace/error message **

Running on CoLab
Collecting pykale[extras]
  Cloning https://github.com/pykale/pykale.git to /tmp/pip-install-152ad5l4/pykale_674492876602436890922aa8e5d76e61
  Running command git clone -q https://github.com/pykale/pykale.git /tmp/pip-install-152ad5l4/pykale_674492876602436890922aa8e5d76e61
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
WARNING: pykale 0.1.0rc2 does not provide the extra 'extras'
Requirement already satisfied: ipython in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (5.5.0)
Requirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (1.19.5)
Collecting PyTDC
  Downloading PyTDC-0.2.0.tar.gz (73 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 73 kB 1.3 MB/s 
Collecting pytorch-memlab
  Downloading pytorch_memlab-0.2.3.tar.gz (21 kB)
Collecting scikit-learn>=0.23.2
  Downloading scikit_learn-0.24.2-cp37-cp37m-manylinux2010_x86_64.whl (22.3 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 22.3 MB 34 kB/s 
Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (3.2.2)
Collecting tensorly>=0.5.1
  Downloading tensorly-0.6.0-py3-none-any.whl (160 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 160 kB 45.9 MB/s 
Requirement already satisfied: torchsummary>=1.5.0 in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (1.5.1)
Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (7.1.2)
Requirement already satisfied: torchvision in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (0.10.0+cu102)
Requirement already satisfied: scikit-image>=0.16.2 in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (0.16.2)
Requirement already satisfied: torch>=1.7.0 in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (1.9.0+cu102)
Collecting pytorch-lightning>=1.3.0
  Downloading pytorch_lightning-1.4.2-py3-none-any.whl (916 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 916 kB 41.0 MB/s 
Collecting scipy>=1.5.4
  Downloading scipy-1.7.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (28.5 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 28.5 MB 47 kB/s 
Requirement already satisfied: ipykernel in /usr/local/lib/python3.7/dist-packages (from pykale[extras]) (4.10.1)
Collecting yacs>=0.1.7
  Downloading yacs-0.1.8-py3-none-any.whl (14 kB)
Collecting future>=0.17.1
  Downloading future-0.18.2.tar.gz (829 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 829 kB 31.2 MB/s 
Collecting PyYAML>=5.1
  Downloading PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (636 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 636 kB 38.5 MB/s 
Collecting fsspec[http]!=2021.06.0,>=2021.05.0
  Downloading fsspec-2021.7.0-py3-none-any.whl (118 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 118 kB 59.6 MB/s 
Requirement already satisfied: tensorboard>=2.2.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning>=1.3.0->pykale[extras]) (2.5.0)
Collecting torchmetrics>=0.4.0
  Downloading torchmetrics-0.5.0-py3-none-any.whl (272 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 272 kB 50.5 MB/s 
Requirement already satisfied: packaging>=17.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning>=1.3.0->pykale[extras]) (21.0)
Collecting pyDeprecate==0.3.1
  Downloading pyDeprecate-0.3.1-py3-none-any.whl (10 kB)
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning>=1.3.0->pykale[extras]) (3.7.4.3)
Requirement already satisfied: tqdm>=4.41.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning>=1.3.0->pykale[extras]) (4.41.1)
Collecting aiohttp
  Downloading aiohttp-3.7.4.post0-cp37-cp37m-manylinux2014_x86_64.whl (1.3 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.3 MB 34.0 MB/s 
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (2.23.0)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=17.0->pytorch-lightning>=1.3.0->pykale[extras]) (2.4.7)
Requirement already satisfied: PyWavelets>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.16.2->pykale[extras]) (1.1.1)
Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.16.2->pykale[extras]) (2.4.1)
Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.16.2->pykale[extras]) (2.5.1)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pykale[extras]) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pykale[extras]) (1.3.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pykale[extras]) (0.10.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib->pykale[extras]) (1.15.0)
Requirement already satisfied: decorator<5,>=4.3 in /usr/local/lib/python3.7/dist-packages (from networkx>=2.0->scikit-image>=0.16.2->pykale[extras]) (4.4.2)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.23.2->pykale[extras]) (1.0.1)
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-2.2.0-py3-none-any.whl (12 kB)
Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.34.1)
Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (57.2.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (3.3.4)
Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.6.1)
Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.36.2)
Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (3.17.3)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.4.4)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.8.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.32.1)
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.0.1)
Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.12.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (4.2.2)
Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (4.7.2)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.2.8)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.3.0)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (4.6.1)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (0.4.8)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (2.10)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (1.24.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (2021.5.30)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (3.1.1)
Collecting nose
  Downloading nose-1.3.7-py3-none-any.whl (154 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 154 kB 73.4 MB/s 
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning>=1.3.0->pykale[extras]) (21.2.0)
Collecting multidict<7.0,>=4.5
  Downloading multidict-5.1.0-cp37-cp37m-manylinux2014_x86_64.whl (142 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 142 kB 70.8 MB/s 
Collecting async-timeout<4.0,>=3.0
  Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.6.3-cp37-cp37m-manylinux2014_x86_64.whl (294 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 294 kB 68.0 MB/s 
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->markdown>=2.6.8->tensorboard>=2.2.0->pytorch-lightning>=1.3.0->pykale[extras]) (3.5.0)
Requirement already satisfied: jupyter-client in /usr/local/lib/python3.7/dist-packages (from ipykernel->pykale[extras]) (5.3.5)
Requirement already satisfied: tornado>=4.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel->pykale[extras]) (5.1.1)
Requirement already satisfied: traitlets>=4.1.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel->pykale[extras]) (5.0.5)
Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from ipython->pykale[extras]) (2.6.1)
Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.7/dist-packages (from ipython->pykale[extras]) (0.8.1)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.7/dist-packages (from ipython->pykale[extras]) (1.0.18)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.7/dist-packages (from ipython->pykale[extras]) (0.7.5)
Requirement already satisfied: pexpect in /usr/local/lib/python3.7/dist-packages (from ipython->pykale[extras]) (4.8.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.7/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython->pykale[extras]) (0.2.5)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.7/dist-packages (from traitlets>=4.1.0->ipykernel->pykale[extras]) (0.2.0)
Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel->pykale[extras]) (22.1.0)
Requirement already satisfied: jupyter-core>=4.6.0 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel->pykale[extras]) (4.7.1)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.7/dist-packages (from pexpect->ipython->pykale[extras]) (0.7.0)
Collecting fuzzywuzzy
  Downloading fuzzywuzzy-0.18.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from PyTDC->pykale[extras]) (1.1.5)
Requirement already satisfied: seaborn in /usr/local/lib/python3.7/dist-packages (from PyTDC->pykale[extras]) (0.11.1)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->PyTDC->pykale[extras]) (2018.9)
Collecting calmsize
  Downloading calmsize-0.1.3.tar.gz (3.7 kB)
Building wheels for collected packages: pykale, future, PyTDC, pytorch-memlab, calmsize
  Building wheel for pykale (PEP 517) ... done
  Created wheel for pykale: filename=pykale-0.1.0rc2-py2.py3-none-any.whl size=133155 sha256=57c8de8e048d605ed228ee1502bcddb68a2403fe91214a10133229a808214ffd
  Stored in directory: /tmp/pip-ephem-wheel-cache-13m5rj5v/wheels/c1/55/38/ee279131d91650716ebcd64b3b7c9c3dd2a09359176663fabf
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491070 sha256=22406cefd7a6fef9bc2feef1d7ee86f1839ce1da36953c41f96e4f056503f15f
  Stored in directory: /root/.cache/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0
  Building wheel for PyTDC (setup.py) ... done
  Created wheel for PyTDC: filename=PyTDC-0.2.0-py3-none-any.whl size=79519 sha256=607c9dcb8e1c7a367ad8ed9386b2ffa4474da298fd68ded326518c56ff661ec9
  Stored in directory: /root/.cache/pip/wheels/e5/e5/66/3dfd956e2e078a1ffda5819843469be9cad0a33dc2dfee5163
  Building wheel for pytorch-memlab (setup.py) ... done
  Created wheel for pytorch-memlab: filename=pytorch_memlab-0.2.3-py3-none-any.whl size=20196 sha256=9957b6a827c4e3d6c5bbd876e9fcd38767ca96b564fe7af9514c6f7b0bc10752
  Stored in directory: /root/.cache/pip/wheels/38/72/a9/b7c27b9cb14298e8b283eb8ded7c2fdc896e6b3609bd0af51a
  Building wheel for calmsize (setup.py) ... done
  Created wheel for calmsize: filename=calmsize-0.1.3-py3-none-any.whl size=2889 sha256=ed72ad96ddf15e1fbb1d7fd5caba2cba5e434d650d165005b130ed87214c218f
  Stored in directory: /root/.cache/pip/wheels/a3/92/5f/c4c4e3fa257084aecbdc44c0fe60bdef0cb870603f3642dd96
Successfully built pykale future PyTDC pytorch-memlab calmsize
Installing collected packages: multidict, yarl, async-timeout, threadpoolctl, scipy, fsspec, aiohttp, torchmetrics, scikit-learn, PyYAML, pyDeprecate, nose, fuzzywuzzy, future, calmsize, yacs, tensorly, pytorch-memlab, pytorch-lightning, PyTDC, pykale
  Attempting uninstall: scipy
    Found existing installation: scipy 1.4.1
    Uninstalling scipy-1.4.1:
      Successfully uninstalled scipy-1.4.1
  Attempting uninstall: scikit-learn
    Found existing installation: scikit-learn 0.22.2.post1
    Uninstalling scikit-learn-0.22.2.post1:
      Successfully uninstalled scikit-learn-0.22.2.post1
  Attempting uninstall: PyYAML
    Found existing installation: PyYAML 3.13
    Uninstalling PyYAML-3.13:
      Successfully uninstalled PyYAML-3.13
  Attempting uninstall: future
    Found existing installation: future 0.16.0
    Uninstalling future-0.16.0:
      Successfully uninstalled future-0.16.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.
Successfully installed PyTDC-0.2.0 PyYAML-5.4.1 aiohttp-3.7.4.post0 async-timeout-3.0.1 calmsize-0.1.3 fsspec-2021.7.0 future-0.18.2 fuzzywuzzy-0.18.0 multidict-5.1.0 nose-1.3.7 pyDeprecate-0.3.1 pykale-0.1.0rc2 pytorch-lightning-1.4.2 pytorch-memlab-0.2.3 scikit-learn-0.24.2 scipy-1.7.1 tensorly-0.6.0 threadpoolctl-2.2.0 torchmetrics-0.5.0 yacs-0.1.8 yarl-1.6.3
Cloning into 'pykale'...
remote: Enumerating objects: 8815, done.
remote: Counting objects: 100% (539/539), done.
remote: Compressing objects: 100% (347/347), done.
remote: Total 8815 (delta 349), reused 333 (delta 191), pack-reused 8276
Receiving objects: 100% (8815/8815), 15.13 MiB | 25.03 MiB/s, done.
Resolving deltas: 100% (6304/6304), done.
/content/pykale/examples/digits_dann_lightn

Expected Behaviour

No errors or warnings.

Environment

As per Google collab.

Additional context

The first warning acn be resolved by removing #egg=pykale[extras] from the pip install.

[Bug] Nightly testing failing due to certifi update

πŸ› Bug

certifi update caused tests to fail: https://pypi.org/project/certifi/#history

To reproduce

Rerun https://github.com/pykale/pykale/runs/3850033562?check_suite_focus=true

** Stack trace/error message **

Requirement already satisfied: six>=1.5 in /usr/share/miniconda/envs/test/lib/python3.6/site-packages (from python-dateutil>=2.7.3->pandas->torch-geometric) (1.16.0)
Collecting isodate
  Downloading isodate-0.6.0-py2.py3-none-any.whl (45 kB)
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.6-py3-none-any.whl (37 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.2-py3-none-any.whl (59 kB)
Collecting joblib>=0.11
  Downloading joblib-1.1.0-py2.py3-none-any.whl (306 kB)
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-3.0.0-py3-none-any.whl (14 kB)
Building wheels for collected packages: torch-geometric
  Building wheel for torch-geometric (setup.py): started
  Building wheel for torch-geometric (setup.py): finished with status 'done'
  Created wheel for torch-geometric: filename=torch_geometric-2.0.1-py3-none-any.whl size=513822 sha256=711cdb5730ba8cab173df431744d9e350272ce42fb1dfcc1b190022173f45149
  Stored in directory: /home/runner/.cache/pip/wheels/c5/93/f4/09e8c8a1c61bd87f295533b91ea66e309e7d2e8c503cabf761
Successfully built torch-geometric
Installing collected packages: urllib3, threadpoolctl, PyYAML, MarkupSafe, joblib, isodate, idna, decorator, charset-normalizer, certifi, yacs, tqdm, scikit-learn, requests, rdflib, networkx, jinja2, googledrivedownloader, torch-geometric
  Attempting uninstall: certifi
    Found existing installation: certifi 2016.9.26
ERROR: Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Error: Process completed with exit code 1.

Expected Behaviour

test fails.

About random seed

def set_seed(seed=1000):

Do we need to set the seed for GPU to reproduce the result like MMCV?

From here, it shows 'You can use torch.manual_seed() to seed the RNG for all devices (both CPU and CUDA)'. Does it mean torch.manual_seed() is also for GPU?

However, from here, it shows that torch.cuda.manual_seed(seed) and torch.cuda.manual_seed_all(seed) are needed to set seed for GPU. I feel a little confused now.

[Bug] test_video_access error for python 3.7/3.8 starting 2nd July

πŸ› Bug

CI test_video_access started to report errors since yesterday PM for python 3.7 and 3.8. It was OK when Bob ran it yesterday morning and for other recent tests. Not sure what has been changed in between on the system or elsewhere. The tests can pass on python 3.6. The error is TypeError and seems to be associated with pickle.load below

tests/loaddata/test_video_access.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
kale/loaddata/video_access.py:254: in get_train
    n_classes=self._n_classes,
kale/loaddata/video_datasets.py:120: in __init__
    test_mode,
kale/loaddata/videos.py:149: in __init__
    self._parse_list()
kale/loaddata/video_datasets.py:124: in _parse_list
    self.video_list = [VideoRecord(x, self.img_path) for x in list(self.make_dataset())]
kale/loaddata/video_datasets.py:146: in make_dataset
    input_file = pickle.load(input_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __cinit__() takes at least 2 positional arguments (0 given)

pandas/_libs/internals.pyx:572: TypeError

Some related searches
h5py/h5py#1092
https://stackoverflow.com/questions/34569664/typeerror-cinit-takes-exactly-8-positional-arguments-3-given-when-loa
https://bugs.python.org/issue32696

To reproduce

See https://github.com/pykale/pykale/runs/2978244183 or https://github.com/pykale/pykale/runs/2975724777 or rerun past successful tests

** Stack trace/error message **

=================================== FAILURES ===================================
_ test_get_source_target[class_subset0-max-natural-0.1-EPIC;8;epic_D1_train.pkl;epic_D1_test.pkl-EPIC;8;epic_D1_train.pkl;epic_D1_test.pkl] _

source_cfg = 'EPIC;8;epic_D1_train.pkl;epic_D1_test.pkl'
target_cfg = 'EPIC;8;epic_D1_train.pkl;epic_D1_test.pkl', val_ratio = 0.1
weight_type = 'natural', datasize_type = 'max'
testing_cfg = CfgNode({'DATASET': CfgNode({'ROOT': '/home/runner/work/tests/test_data/video_test_data/', 'IMAGE_MODALITY': 'joint', ...R_TRAINLIST': 'epic_D1_train.pkl', 'TAR_TESTLIST': 'epic_D1_test.pkl', 'WEIGHT_TYPE': 'natural', 'SIZE_TYPE': 'max'})})
class_subset = [1, 3, 8]

    @pytest.mark.parametrize("source_cfg", SOURCES)
    @pytest.mark.parametrize("target_cfg", TARGETS)
    @pytest.mark.parametrize("val_ratio", VAL_RATIO)
    @pytest.mark.parametrize("weight_type", WEIGHT_TYPE)
    @pytest.mark.parametrize("datasize_type", DATASIZE_TYPE)
    @pytest.mark.parametrize("class_subset", CLASS_SUBSETS)
    def test_get_source_target(source_cfg, target_cfg, val_ratio, weight_type, datasize_type, testing_cfg, class_subset):
        source_name, source_n_class, source_trainlist, source_testlist = source_cfg.split(";")
        target_name, target_n_class, target_trainlist, target_testlist = target_cfg.split(";")
        n_class = eval(min(source_n_class, target_n_class))
    
        # get cfg parameters
        cfg = testing_cfg
        cfg.DATASET.SOURCE = source_name
        cfg.DATASET.SRC_TRAINLIST = source_trainlist
        cfg.DATASET.SRC_TESTLIST = source_testlist
        cfg.DATASET.TARGET = target_name
        cfg.DATASET.TAR_TRAINLIST = target_trainlist
        cfg.DATASET.TAR_TESTLIST = target_testlist
        cfg.DATASET.WEIGHT_TYPE = weight_type
        cfg.DATASET.SIZE_TYPE = datasize_type
    
        download_file_by_url(
            url=url,
            output_directory=str(Path(cfg.DATASET.ROOT).parent.absolute()),
            output_file_name="video_test_data.zip",
            file_format="zip",
        )
    
        # test get_source_target
        source, target, num_classes = VideoDataset.get_source_target(
            VideoDataset(source_name), VideoDataset(target_name), seed, cfg
        )
    
        assert num_classes == n_class
        assert isinstance(source, dict)
        assert isinstance(target, dict)
        assert isinstance(source["rgb"], VideoDatasetAccess)
        assert isinstance(target["rgb"], VideoDatasetAccess)
        assert isinstance(source["flow"], VideoDatasetAccess)
        assert isinstance(target["flow"], VideoDatasetAccess)
    
        # test get_train & get_test
>       assert isinstance(source["rgb"].get_train(), torch.utils.data.Dataset)

tests/loaddata/test_video_access.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
kale/loaddata/video_access.py:254: in get_train
    n_classes=self._n_classes,
kale/loaddata/video_datasets.py:120: in __init__
    test_mode,
kale/loaddata/videos.py:149: in __init__
    self._parse_list()
kale/loaddata/video_datasets.py:124: in _parse_list
    self.video_list = [VideoRecord(x, self.img_path) for x in list(self.make_dataset())]
kale/loaddata/video_datasets.py:146: in make_dataset
    input_file = pickle.load(input_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __cinit__() takes at least 2 positional arguments (0 given)

pandas/_libs/internals.pyx:572: TypeError
----------------------------- Captured stdout call -----------------------------
Downloading https://github.com/pykale/data/raw/main/video_data/video_test_data.zip to /home/runner/work/tests/test_data/video_test_data.zip
Extracting /home/runner/work/tests/test_data/video_test_data.zip to /home/runner/work/tests/test_data
----------------------------- Captured stderr call -----------------------------

Expected Behaviour

I've rerun 10+ times in the past 18 hours but all failed

Environment

See GitHub actions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.