Open LifGorg opened 7 months ago
Hi there,
This is a straightforward error caused by pip install -r requirements.txt, I checked its line 88:
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work
and see a local file path here.ubuntu 20.04 Commands to reproduce:
conda create -n environment python==3.8 conda activate environment pip install -r requirements.txt
Error Logpip install -r requirements.txt Obtaining clip from git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1#egg=clip (from -r requirements.txt (line 13)) Skipping because already up-to-date. Preparing metadata (setup.py) ... done Processing /home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work (from -r requirements.txt (line 88)) ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work
Just removed @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work from line 88, and pip install went through. Now running python generate_pre_data.py --mode=pre_traj_crop --dataset_mode=train --top_k=16 results in the following Error:
Traceback (most recent call last): File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1146, in _get_module return importlib.import_module("." + module_name, self.name) File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/models/detr/modeling_detr.py", line 48, in from timm import create_model File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/init.py", line 2, in from .models import create_model, list_models, is_model, list_modules, model_entrypoint, File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/init.py", line 1, in from .cspnet import * File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/cspnet.py", line 20, in from .helpers import build_model_with_cfg File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/helpers.py", line 17, in from .layers import Conv2dSame, Linear File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/init.py", line 7, in from .cond_conv2d import CondConv2d, get_condconv_initializer File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/cond_conv2d.py", line 16, in from .helpers import to_2tuple File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/helpers.py", line 6, in from torch._six import container_abcs ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/torch/_six.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/yliu/Demand-driven-navigation/generate_pre_data.py", line 13, in from model.detr import DETRModel File "/home/yliu/Demand-driven-navigation/model/detr.py", line 15, in from transformers import DetrForObjectDetection File "", line 1055, in _handle_fromlist File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1137, in getattr value = getattr(module, name) File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1136, in getattr module = self._get_module(self._class_to_module[name]) File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1148, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.models.detr.modeling_detr because of the following error (look up to see its traceback): cannot import name 'container_abcs' from 'torch._six' (/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/torch/_six.py)
Hi, Here are some references to solve your question. https://stackoverflow.com/questions/70193443/colab-notebook-cannot-import-name-container-abcs-from-torch-six
change the from torch._six import container_abcs
to import collections.abc as container_abcs
in timm
Thanks, that worked.
Now running python train_attribute_features.py --epoch=5000
cause the following problem. I checked the LGO_features.json file and found this line empty.
Thanks, that worked.
Now running
python train_attribute_features.py --epoch=5000
cause the following problem. I checked the LGO_features.json file and found this line empty.
Hi, I'm kind of forgetting the details here. I recommend simply removing this instruction, which will not significantly affect performance. Or you can use the BERT model to encode the instruction yourself and its example code is shown as below.
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-large-uncased')
model = BertModel.from_pretrained("bert-large-uncased")
encoded_input = tokenizer(instruction, return_tensors='pt')
output = model(**encoded_input)
print(output["pooler_output"])
Thank you~!
I simply deleted the empty lines for now. And had run into a new problem where the instruction_val_check.json does not have any same key as the LGO_features.json, leading to an empty validation dataset.
Thank you~!
I simply deleted the empty lines for now. And had run into a new problem where the instruction_val_check.json does not have any same key as the LGO_features.json, leading to an empty validation dataset.
Hi, This may be caused by the fact that the LGO_feature file I uploaded was crippled, and I updated the LGO_feature once in a previous issue. LGO_feature.json is just a chche file. you can simply generate LGO_feature.json yourself use the code below.
import json
import os
import random
import time
from tqdm import tqdm
import clip
import torch
device = "cuda:1" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)
with open('./dataset/LGO_all.json', 'r', encoding='utf8') as fp:
json_data = json.load(fp)
LGO_features = {}
for instruction in tqdm(json_data.keys()):
LGO_features[instruction] = {}
obj_sentence = []
for obj in json_data[instruction]:
obj_sentence.append("This is a "+obj)
text = clip.tokenize(obj_sentence).to(device)
text_features = model.encode_text(text).cpu().detach().numpy().tolist()
for obj, features in zip(json_data[instruction], text_features):
LGO_features[instruction][obj] = features
info_json = json.dumps(LGO_features, sort_keys=False, indent=4, separators=(',', ': '))
f = open('../dataset/LGO_features.json', 'w')
f.write(info_json)
I just push the LGO_all.json
file into this repo. Please pull again.
Hi there,
This is a straightforward error caused by pip install -r requirements.txt, I checked its line 88:
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work
and see a local file path here.ubuntu 20.04 Commands to reproduce:
conda create -n environment python==3.8 conda activate environment pip install -r requirements.txt
Error Logpip install -r requirements.txt Obtaining clip from git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1#egg=clip (from -r requirements.txt (line 13)) Skipping because already up-to-date. Preparing metadata (setup.py) ... done Processing /home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work (from -r requirements.txt (line 88)) ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work
Just removed @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work from line 88, and pip install went through. Now running python generate_pre_data.py --mode=pre_traj_crop --dataset_mode=train --top_k=16 results in the following Error:
Traceback (most recent call last): File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1146, in _get_module return importlib.import_module("." + module_name, self.name) File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/models/detr/modeling_detr.py", line 48, in
from timm import create_model
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/init.py", line 2, in
from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/init.py", line 1, in
from .cspnet import *
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/cspnet.py", line 20, in
from .helpers import build_model_with_cfg
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/helpers.py", line 17, in
from .layers import Conv2dSame, Linear
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/init.py", line 7, in
from .cond_conv2d import CondConv2d, get_condconv_initializer
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/cond_conv2d.py", line 16, in
from .helpers import to_2tuple
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/timm/models/layers/helpers.py", line 6, in
from torch._six import container_abcs
ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/torch/_six.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/yliu/Demand-driven-navigation/generate_pre_data.py", line 13, in
from model.detr import DETRModel
File "/home/yliu/Demand-driven-navigation/model/detr.py", line 15, in
from transformers import DetrForObjectDetection
File "", line 1055, in _handle_fromlist
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1137, in getattr
value = getattr(module, name)
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1136, in getattr
module = self._get_module(self._class_to_module[name])
File "/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/transformers/utils/import_utils.py", line 1148, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.detr.modeling_detr because of the following error (look up to see its traceback):
cannot import name 'container_abcs' from 'torch._six' (/home/yliu/miniconda3/envs/DDN/lib/python3.9/site-packages/torch/_six.py)