mrdbourke / pytorch-deep-learning

Materials for the Learn PyTorch for Deep Learning: Zero to Mastery course.
https://learnpytorch.io
MIT License
9.69k stars 2.88k forks source link

Error to import data_setup , engine #692

Open Soumya-Kanti-Roy opened 9 months ago

Soumya-Kanti-Roy commented 9 months ago
# Continue with regular imports
import matplotlib.pyplot as plt
import torch
import torchvision

from torch import nn
from torchvision import transforms

# Try to get torchinfo, install it if it doesn't work
try:
    from torchinfo import summary
except:
    print("[INFO] Couldn't find torchinfo... installing it.")
    !pip install -q torchinfo
    from torchinfo import summary

# Try to import the going_modular directory, download it from GitHub if it doesn't work

    # Get the going_modular scripts
try:
    from going_modular.going_modular import data_setup, engine

except:
    # Get the going_modular scripts
    print("[INFO] Couldn't find going_modular scripts... downloading them from GitHub.")
    !git clone https://github.com/mrdbourke/pytorch-deep-learning
    !mv pytorch-deep-learning/going_modular .
    !rm -rf pytorch-deep-learning
    from going_modular.going_modular import data_setup, engine 
**The above code provides error which is:**

fatal: destination path 'pytorch-deep-learning' already exists and is not an empty directory.
'mv' is not recognized as an internal or external command,
operable program or batch file.
'rm' is not recognized as an internal or external command,
operable program or batch file.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[13], line 21
     20 try:
---> 21     from going_modular.going_modular import data_setup, engine
     23 except:
     24     # Get the going_modular scripts

File ~\Downloads\Task_2A_files\Task_2A_files\going_modular\going_modular\engine.py:6
      4 import torch
----> 6 from tqdm.auto import tqdm
      7 from typing import Dict, List, Tuple

ModuleNotFoundError: No module named 'tqdm'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[13], line 29
     27 get_ipython().system('mv pytorch-deep-learning/going_modular .')
     28 get_ipython().system('rm -rf pytorch-deep-learning')
---> 29 from going_modular.going_modular import data_setup, engine

File ~\Downloads\Task_2A_files\Task_2A_files\going_modular\going_modular\engine.py:6
      1 """
      2 Contains functions for training and testing a PyTorch model.
      3 """
      4 import torch
----> 6 from tqdm.auto import tqdm
      7 from typing import Dict, List, Tuple
      9 def train_step(model: torch.nn.Module, 
     10                dataloader: torch.utils.data.DataLoader, 
     11                loss_fn: torch.nn.Module, 
     12                optimizer: torch.optim.Optimizer,
     13                device: torch.device) -> Tuple[float, float]:

ModuleNotFoundError: No module named 'tqdm'
mrdbourke commented 9 months ago

Hi @Soumya-Kanti-Roy ,

Can you provide some more context on your errror?

Where are you trying to run the code?

What steps have you taken so far to get there?

And what steps have you tried to troubleshoot so far?

Soumya-Kanti-Roy commented 9 months ago

2:i am trying to run the code in jupyter ide 3:i have searched in google Screenshot (98) please give me quick solution