Comments (6)
post code here.
Generally in python it would be:
from python_lightning import Trainer
Look at the demo here for instructions:
https://github.com/williamFalcon/pytorch-lightning#how-do-i-do-use-it
from pytorch-lightning.
From command line itself it is not able to import. Importing pytorch_lightning is working though.
import pytorch_lightning
from pytorch_lightning import Trainer
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name Trainer
from pytorch-lightning.
Found existing installation: pytorch-lightning 0.3.6.9
Uninstalling pytorch-lightning-0.3.6.9:
Successfully uninstalled pytorch-lightning-0.3.6.9
Running setup.py develop for pytorch-lightning
Successfully installed pytorch-lightning test-tube-0.6.7.6
(lightning) user:~/Developer/pytorch-lightning$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning
>>> from pytorch_lightning import Trainer
>>>
Seems strange. I just tried, it works. Tests also work...
Maybe it's your install?
What does your conda env look like? Are you also using the latest lightning version?
from pytorch-lightning.
Even after re-installation, same problem persists.
(sameer27) ece@ece-System-Product-Name:~$ pip install pytorch_lightning
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pytorch_lightning
Collecting test-tube (from pytorch_lightning)
Requirement already satisfied: torch in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from pytorch_lightning) (1.1.0)
Requirement already satisfied: tqdm in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from pytorch_lightning) (4.32.2)
Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (1.14.0)
Requirement already satisfied: pandas>=0.20.3 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (0.24.2)
Requirement already satisfied: future in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (0.17.1)
Requirement already satisfied: tb-nightly==1.15.0a20190708 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (1.15.0a20190708)
Requirement already satisfied: imageio>=2.3.0 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (2.5.0)
Requirement already satisfied: pytz>=2011k in ./.local/lib/python2.7/site-packages (from pandas>=0.20.3->test-tube->pytorch_lightning) (2017.3)
Requirement already satisfied: python-dateutil>=2.5.0 in ./.local/lib/python2.7/site-packages (from pandas>=0.20.3->test-tube->pytorch_lightning) (2.6.1)
Requirement already satisfied: grpcio>=1.6.3 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (1.21.1)
Requirement already satisfied: absl-py>=0.4 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.7.1)
Requirement already satisfied: protobuf>=3.6.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.8.0)
Requirement already satisfied: futures>=3.1.1; python_version < "3" in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.2.0)
Requirement already satisfied: wheel; python_version < "3" in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.33.4)
Requirement already satisfied: werkzeug>=0.11.15 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.15.4)
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.1.1)
Requirement already satisfied: six>=1.10.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (1.12.0)
Requirement already satisfied: setuptools>=41.0.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (41.0.1)
Requirement already satisfied: pillow in ./.local/lib/python2.7/site-packages (from imageio>=2.3.0->test-tube->pytorch_lightning) (5.0.0)
Requirement already satisfied: enum34 in ./.local/lib/python2.7/site-packages (from imageio>=2.3.0->test-tube->pytorch_lightning) (1.1.6)
Installing collected packages: test-tube, pytorch-lightning
Successfully installed pytorch-lightning-0.0.2 test-tube-0.6.7.6
(sameer27) ece@ece-System-Product-Name:~$ python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning
>>> from pytorch_lightning import Trainer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name Trainer
from pytorch-lightning.
oh yeah, use python 3+. Recommended 3.7
from pytorch-lightning.
Ok, I will try it. Thanks a lot.
from pytorch-lightning.
Related Issues (20)
- Confusing recommendation to use sync_dist=True even with TorchMetrics HOT 7
- Bug: automatic logging doesn't log metric on steps if .update is used
- Remove the `optimizer_to_device` logic if possible HOT 3
- False positive iterable dataset warning for LitData StreamingDataset
- Inconsistent input io type between `to_onnx` and `torch.onnx.export`.
- loss spikes in validation step when the model has multiple losses applied HOT 1
- Trainer does not switch to train mode after validation step HOT 2
- trainer.validate() get different result from trainer.fit
- trainer test and validate have issues with autograd
- `Error while merging hparams` when using LightningCLI and YAML HOT 3
- MLFlowLogger does not save config.yaml for each run
- Checkpoint callback run before validation step - stale or none monitor values considered for validation metrics HOT 2
- OnExceptionCheckpoint callback suppresses exceptions and results in NCCL timeout
- Seeding and multi-GPU training HOT 1
- Support IO Type Checkpoints for trainer.fit() in ckpt_path Parameter
- shortcuts for logging weights and biases norms
- Unable to load Checkpoint
- Add param_group name for BaseFinetuningCallback
- LightningCLI: --help argument given after the subcommand fails
- ModelCheckpoint Callback not working/saving unless `save_on_train_epoch_end` is enabled True which considerably slows down training
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-lightning.