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 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 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 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 lightning.
oh yeah, use python 3+. Recommended 3.7
from lightning.
Ok, I will try it. Thanks a lot.
from lightning.
Related Issues (20)
- Construct objects from yaml by classmethod
- FSDP Strategy checkpoint loading
- Current FSDPPrecision does not support custom scaler for 16-mixed precision
- Differentiate testing multiple sets/models when logging
- Issue in Manual optimisation, during self.manual_backward call HOT 1
- Existing metric keys not moved to device after LearningRateFinder
- Checkpoint every_n_steps reruns epoch on restore HOT 3
- Metrics logged by self.log and metric.compute() are different HOT 1
- Multi-node Training with DDP stuck at "Initialize distributed..." on SLURM cluster HOT 3
- Full validation after first microbatch when training after LearningRateFinder
- Add a warning when some of the modules are in eval mode before the training stage
- why pytorch-lightning doc say "Model-parallel training (FSDP and DeepSpeed)". I think there is something wrong. HOT 1
- AWS Trainium fails number of device validation when using more than 1 accelerator on the instances
- OnExceptionCheckpoint: training resumes if ckpt found, even if no ckpt_path provided
- TensorBoardLogger has the wrong epoch numbers much more than the fact
- How to incorporate vLLM in Lightning for LLM inference?
- WandbLogger `save_dir` and `dir` parameters do not work as expected.
- Loading large models with fabric, FSDP and empty_init=True does not work
- Unable to extract confusion matrix as a metric from trainer
- Torchmetrics Accuracy issue when dont shuffle test data. HOT 1
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 lightning.