Open Caltech-Z opened 2 years ago
Q1 is related to torchvision version. Please ensure you install PyTorch == 1.7.1+cu102, TorchVision == 0.8.2+cu102
Q2 is related to the permission of basetrain.sh. To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.
Run the following command:
chmod u+x ./basetrain.sh
should solve the problem.
Q1:ImportError: cannot import name '_NewEmptyTensorOp' from 'torchvision.ops.misc' Q2:PermissionError: [Errno 13] Permission denied: './basetrain.sh' For the above two questions, can the owner answer them?
I also met Q1 question, if you don't want to change pytorch version, you can delete these codes from misc.py. This method can run all codes correctly. But I am not sure if it's OK to use different pytorch version with authors. Maybe different versions will affect results performance.
Q1:ImportError: cannot import name '_NewEmptyTensorOp' from 'torchvision.ops.misc' Q2:PermissionError: [Errno 13] Permission denied: './basetrain.sh' For the above two questions, can the owner answer them?
I also met Q1 question, if you don't want to change pytorch version, you can delete these codes from misc.py. This method can run all codes correctly. But I am not sure if it's OK to use different pytorch version with authors. Maybe different versions will affect results performance.
Thanks for your comments! I will check this issue after CVPR deadline.
Q1:ImportError: cannot import name '_NewEmptyTensorOp' from 'torchvision.ops.misc' Q2:PermissionError: [Errno 13] Permission denied: './basetrain.sh' For the above two questions, can the owner answer them?
About Q2 question, I agree with author's reply, in Meta-DETR-main folder, I input 'chmod 777 ./basetrain.sh' in terminal
Q1 is related to torchvision version. Please ensure you install PyTorch == 1.7.1+cu102, TorchVision == 0.8.2+cu102
Q2 is related to the permission of basetrain.sh. To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.
Run the following command:
chmod u+x ./basetrain.sh
should solve the problem.
According to your request, I executed it step by step, but I still found the error, the error is as follows OSError: [Errno 8] Exec format error: '. /basetrain.sh'
'''
## needed due to empty tensor bug in pytorch and torchvision 0.5
import torchvision
if float(torchvision.__version__[:3]) < 0.5:
import math
from torchvision.ops.misc import _NewEmptyTensorOp
def _check_size_scale_factor(dim, size, scale_factor):
# type: (int, Optional[List[int]], Optional[float]) -> None
if size is None and scale_factor is None:
raise ValueError("either size or scale_factor should be defined")
if size is not None and scale_factor is not None:
raise ValueError("only one of size or scale_factor should be defined")
if not (scale_factor is not None and len(scale_factor) != dim):
raise ValueError(
"scale_factor shape must match input shape. "
"Input is {}D, scale_factor size is {}".format(dim, len(scale_factor))
)
def _output_size(dim, input, size, scale_factor):
# type: (int, Tensor, Optional[List[int]], Optional[float]) -> List[int]
assert dim == 2
_check_size_scale_factor(dim, size, scale_factor)
if size is not None:
return size
# if dim is not 2 or scale_factor is iterable use _ntuple instead of concat
assert scale_factor is not None and isinstance(scale_factor, (int, float))
scale_factors = [scale_factor, scale_factor]
# math.floor might return float in py2.7
return [
int(math.floor(input.size(i + 2) * scale_factors[i])) for i in range(dim)
]
elif float(torchvision.__version__[:3]) < 0.7:
from torchvision.ops import _new_empty_tensor
from torchvision.ops.misc import
'''
import torchvision
from packaging import version
if version.parse(torchvision.__version__) < version.parse('0.7'):
from torchvision.ops import _new_empty_tensor
from torchvision.ops.misc import _output_size
您好!您发给我的信件已经收到,我将尽快处理
Q1:ImportError: cannot import name '_NewEmptyTensorOp' from 'torchvision.ops.misc' Q2:PermissionError: [Errno 13] Permission denied: './basetrain.sh' For the above two questions, can the owner answer them?