Code Monkey home page Code Monkey logo

Comments (10)

TheAmazingElys avatar TheAmazingElys commented on May 3, 2024

Hello William,

I tried pytorch-lightning today and I noticed some errors (documentation outdated maybe)

First, the experiment seems to be required now. Some exemples still show it as optionnel.

from pytorch_lightning import Trainer
trainer = Trainer()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-794-1d6d5436d3c1> in <module>
      1 from pytorch_lightning import Trainer
----> 2 trainer = Trainer()

TypeError: __init__() missing 1 required positional argument: 'experiment'

Second, It looks like there is some issues with the Experiment object

import os
from test_tube import Experiment
​
exp = Experiment(os.getcwd())
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-796-eb3933834600> in <module>
      2 from test_tube import Experiment
      3 
----> 4 exp = Experiment(os.getcwd())

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/test_tube/log.py in __init__(self, name, debug, version, save_dir, autosave, description, create_git_tag, rank, *args, **kwargs)
    152         # set the tensorboardx log path to the /tf folder in the exp folder
    153         logdir = self.get_tensorboardx_path(self.name, self.version)
--> 154         super().__init__(log_dir=logdir, *args, **kwargs)
    155 
    156         # register on exit fx so we always close the writer

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/torch/utils/tensorboard/writer.py in __init__(self, log_dir, comment, purge_step, max_queue, flush_secs, filename_suffix)
    219         # and recreated later as needed.
    220         self.file_writer = self.all_writers = None
--> 221         self._get_file_writer()
    222 
    223         # Create default bins for histograms, see generate_testdata.py in tensorflow/tensorboard

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/test_tube/log.py in _get_file_writer(self)
    502 
    503         if self.all_writers is None or self.file_writer is None:
--> 504             if 'purge_step' in self.kwargs.keys():
    505                 most_recent_step = self.kwargs.pop('purge_step')
    506                 self.file_writer = FileWriter(logdir=self.log_dir, **self.kwargs)

AttributeError: 'Experiment' object has no attribute 'kwargs'

My versions are:
test-tube==0.6.7.6
pytorch-lightning==0.3.6.9

If there some problem on my side? Maybe you prefer if I open two separates issues?

Regards,
Robin

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

Experiment(save_dir=os.getcwd())

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

Experiment is required. it's just redundant to add it to every example in the documentation. it obscures the specific flag we're discussing in that documentation item

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

See the readme for a full working example:
https://github.com/williamFalcon/pytorch-lightning#how-do-i-do-use-it

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

but yeah, maybe the experiment argument can be optional

from lightning.

TheAmazingElys avatar TheAmazingElys commented on May 3, 2024

Thank for your answer.

It's indeed the code that I tested, I just forgot to add the 'save_dir=' in the test I copy/pasted here as it was ommited in the test-tube documentation : exp = Experiment('/some/path') here https://github.com/williamFalcon/test-tube.

With the correction, the error stays the same.

exp = Experiment(save_dir=os.getcwd())
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-804-b3fb304b7766> in <module>
----> 1 exp = Experiment(save_dir=os.getcwd())

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/test_tube/log.py in __init__(self, name, debug, version, save_dir, autosave, description, create_git_tag, rank, *args, **kwargs)
    152         # set the tensorboardx log path to the /tf folder in the exp folder
    153         logdir = self.get_tensorboardx_path(self.name, self.version)
--> 154         super().__init__(log_dir=logdir, *args, **kwargs)
    155 
    156         # register on exit fx so we always close the writer

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/torch/utils/tensorboard/writer.py in __init__(self, log_dir, comment, purge_step, max_queue, flush_secs, filename_suffix)
    219         # and recreated later as needed.
    220         self.file_writer = self.all_writers = None
--> 221         self._get_file_writer()
    222 
    223         # Create default bins for histograms, see generate_testdata.py in tensorflow/tensorboard

~/.local/share/virtualenvs/smartch/lib/python3.6/site-packages/test_tube/log.py in _get_file_writer(self)
    502 
    503         if self.all_writers is None or self.file_writer is None:
--> 504             if 'purge_step' in self.kwargs.keys():
    505                 most_recent_step = self.kwargs.pop('purge_step')
    506                 self.file_writer = FileWriter(logdir=self.log_dir, **self.kwargs)

AttributeError: 'Experiment' object has no attribute 'kwargs'

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

that’s weird. can u try on a conda env? maybe it’s somethinng with virtualenv

from lightning.

TheAmazingElys avatar TheAmazingElys commented on May 3, 2024

It works with conda. There is definitively something with virtualenv.

Thank you for your support!

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

released with new core features.
Next release will be a while while we add more advanced features.

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

@rallesiardo good to hear. although actually i think the issue is that pytorch 1.2.0 just released causes issue with summarywriter in test-tube. that'll be fixed soon. in the meantime though we'll keep support for pt 1.1.0

from lightning.

Related Issues (20)

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.