The first few lines of the code of evaluation.py
:
import os
import torch
from torch.nn import functional as F
from torch.utils.data import DataLoader
import numpy as np
from dataset import CLSDataset # warning is reported here
from tqdm import tqdm
The structure of the folder:
./
|-dataset.py
|-dictionary.py
|-evaluation.py
|-model.py
|-models/
|-[some files]
|-__pycache__
|-train.py
Notice that dataset.py
is in the same folder as that of evaluation.py
and https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings says that The language server treats the workspace root (i.e. folder you have opened) as the main root of user module imports. But it still throws an warning of "Import dataset could not be resolved".
I tried to add the
{
"python.analysis.extraPaths": ["./"]
}
on the settings.json of both local and remote files, but it does not help.
In VSCode, go to the main window and do the following:
Do upvote if it helps you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With