Giter Site home page Giter Site logo

lightning-maml's Introduction

Hi there 👋

  • 🔭 I’m currently working on Computer Vision and Reinforcement Learning.
  • 🎯 I'm experienced in Deep Learning using Pytorch and Tensorflow.

Linkedin Badge Twitter Badge

lightning-maml's People

Contributors

rcmalli avatar

Stargazers

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

Watchers

 avatar  avatar

lightning-maml's Issues

Error Instantiating pl.LightningDataModule with hydra.utils.instantiate in run.py

Title:

Error Instantiating pl.LightningDataModule with hydra.utils.instantiate in run.py

Description:

Issue Overview:
No changes were made to the code. When attempting to instantiate a pl.LightningDataModule in run.py using hydra.utils. instantiate, the process fails with an InstantiationException related to the torchmeta.datasets.omniglot.Omniglot class. It appears that the num_classes_per_task parameter is unexpectedly None.

Errror:
The instantiation process throws an InstantiationException, indicating a problem with the num_classes_per_task parameter being None:

发生异常: InstantiationException       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Error in call to target 'torchmeta.datasets.omniglot.Omniglot':
TypeError("Unknown type for `num_classes_per_task`. Expected `int`, got `<class 'NoneType'>`.")
full_key: data.datamodule.datasets.train
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/torchmeta-1.8.0-py3.8.egg/torchmeta/datasets/omniglot.py", line 103, in __init__
    super(Omniglot, self).__init__(dataset, num_classes_per_task,
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/torchmeta-1.8.0-py3.8.egg/torchmeta/utils/data/dataset.py", line 245, in __init__
    raise TypeError('Unknown type for `num_classes_per_task`. Expected '
TypeError: Unknown type for `num_classes_per_task`. Expected `int`, got `<class 'NoneType'>`.

The above exception was the direct cause of the following exception:

  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 366, in instantiate_node
    cfg[key] = instantiate_node(
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 342, in instantiate_node
    value = instantiate_node(
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 226, in instantiate
    return instantiate_node(
  File "/home/Code/Few-Shot/lightning-maml-main/src/run.py", line 96, in run
    datamodule: pl.LightningDataModule = hydra.utils.instantiate(
  File "/home/Code/Few-Shot/lightning-maml-main/src/run.py", line 158, in main
    run(cfg)
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/root/anaconda3/envs/metawifi/lib/python3.8/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/Code/Few-Shot/lightning-maml-main/src/run.py", line 162, in <module>
    main()
  File "/root/anaconda3/envs/metawifi/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/root/anaconda3/envs/metawifi/lib/python3.8/runpy.py", line 194, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
hydra.errors.InstantiationException: Error in call to target 'torchmeta.datasets.omniglot.Omniglot':
TypeError("Unknown type for `num_classes_per_task`. Expected `int`, got `<class 'NoneType'>`.")
full_key: data.datamodule.datasets.train

config:
No changes were made to the configuration

# @package _group_


# The module is communicating with pytorch-lightning
datamodule:
  _target_: pl.datamodule.MetaDataModule


  datasets:
    train:
      _target_: torchmeta.datasets.Omniglot
      root: /home/Code/Few-Shot/lightning-maml-main/data
      meta_train: True
      download: True

    val:
      _target_: torchmeta.datasets.Omniglot
      root: /home/Code/Few-Shot/lightning-maml-main/data
      meta_val: True
      download: True

    test:
      _target_: torchmeta.datasets.Omniglot
      root: /home/Code/Few-Shot/lightning-maml-main/data
      meta_test: True
      download: True

  # number of classes for each task
  nway: 5
  # number of inner steps for adaptation
  num_inner_steps: 1

  # input transformations
  transforms:
    - _target_: torchvision.transforms.Resize
      size: 28
    - _target_: torchvision.transforms.ToTensor


  target_transform:
    _target_: torchmeta.transforms.Categorical

  # this augmentation creates new classes based on rotation.
  class_augmentations:
    - _target_: common.transform.Rotation
      angle:
        - 90
        - 180
        - 270
  # number of tasks for each metadataset split
  batch_size:
    train: 20
    val: 20
    test: 20

  # number of samples per class for a task
  kshot:
    support: 5
    query: 5

  # number of workers to load data to reduce bottleneck
  num_workers:
    train: 2
    val: 2
    test: 2

Environment:
python:3.8.19
pytorch-lightning:2.2.1
torchmet: 1.8.0
hydra-core:1.3.2

Attempts to Resolve:
Checked and verified the configuration files for any obvious misconfigurations.
Searched for similar issues in the repository's issue tracker and on Stack Overflow.
I would appreciate any guidance on resolving this issue to proceed with using the project. Thank you in advance for your help.

Some problems in the process of running the program

  1. The data set cannot be downloaded during the process of the program.
  2. I can download the data set through the browser, though i put the data set in the root folder, but the program still cannot run
  3. Can you introduce Notes in detail in the README file?

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.