-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'type' object is not subscriptable #2
Comments
Hi @jainnipun11, I think I have found the cause of the issue. The return typing hints on this line are incompatible with cvt2distilgpt2/transmodal/network/cvt.py Line 77 in 13d450a
e.g., if we have from typing import Optional, Union, Any
def forward(images) -> Union[dict[str, float], dict[str, Union[float, Any]]]:
return None The following error occurs with compute-i1 ~$ module load python/3.7.11
Loading python/3.7.11
Unloading conflict: python/3.9.4
compute-i1 ~$ python3 tmp.py
Traceback (most recent call last):
File "tmp.py", line 4, in <module>
def forward(images) -> Union[dict[str, float], dict[str, Union[float, Any]]]:
TypeError: 'type' object is not subscriptable
compute-i1 ~$ module load python/3.9.4
Loading python/3.9.4
Unloading conflict: python/3.7.11
compute-i1 ~$ python3 tmp.py
compute-i1 ~$ So, I have removed the return typing hints for that function: cvt2distilgpt2/transmodal/network/cvt.py Line 77 in 7765670
If you can check if this worked, that would be great and please let me know of any further issues after this. Thanks, |
Hey Aaron, I modified according to you and now I got this error: /content/drive/MyDrive/cvt2distilgpt2/transmodal/utils.py:39: UserWarning: Workstation configuration for 5f6e9f0cc0f3 does not exist. Using default configuration: num_workers=5, total_gpus=1, total_memory=16
TypeError: expected str, bytes or os.PathLike object, not NoneType Thanks. |
Hi @jainnipun11, Can you confirm that you have downloaded the files for I have made some updates to check for path issues. Can you please pull the latest version and test? And if problems persist, can you please try python 3.8 or 3.9?? Hope this helps, |
Hey Aaron, I followed all your path instructions and I have stored the 4 files inside the recommended folder. Now, I updated the python version to python 3.9.1, and this is the result: /content/drive/MyDrive/cvt2distilgpt2/transmodal/utils.py:39: UserWarning: Workstation configuration for ad62cbeafeaa does not exist. Using default configuration: num_workers=5, total_gpus=1, total_memory=16
TypeError: expected str, bytes or os.PathLike object, not NoneType |
Hi @jainnipun11, It seems that you did not pull the latest version of the repo. In your error,
Whereas, in the latest repo, it is on line 93: cvt2distilgpt2/transmodal/config.py Line 93 in 618bdba
Please pull the latest repo and we can go from there. Aaron. |
Hey Aaron. This time around I am encountering a different error altogether. I am using Python 3.9. Installed all the requirements using this. Traceback (most recent call last): ValueError: transformers.models.auto.spec is None |
Hi @jainnipun11, Try this: huggingface/transformers#15212 |
Hey Aaron! I referred the repository you suggested, it resolved the issue I was encountering earlier, but again the return type error occured. /content/drive/MyDrive/cvt2distilgpt2/transmodal/utils.py:39: UserWarning: Workstation configuration for b563c33267e1 does not exist. Using default configuration: num_workers=5, total_gpus=1, total_memory=16
Thank you. |
Hi Nipun, I will look into this tomorrow, but in the meantime could you please try this GPT2 example in the same environment and let me know if it works? https://huggingface.co/docs/transformers/model_doc/gpt2#transformers.GPT2LMHeadModel.forward.example Thanks for your patience, |
After I ran "!python3 main.py --task mimic_cxr_jpg_chen". I got the following error:
warnings.warn(f"Workstation configuration for {socket.gethostname()} does not exist. Using default "
Traceback (most recent call last):
File "main.py", line 214, in
main(clargs)
File "main.py", line 58, in main
config = get_config(clargs)
File "/content/drive/MyDrive/cvt2distilgpt2/transmodal/config.py", line 54, in get_config
config = load_config(clargs)
File "/content/drive/MyDrive/cvt2distilgpt2/transmodal/config.py", line 26, in load_config
config = getattr(importlib.import_module(module), "config")()
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/drive/MyDrive/cvt2distilgpt2/task/mimic_cxr_jpg_chen/config/cvt_21_to_distilgpt2_scst.py", line 1, in
from config.cvt_21_to_distilgpt2_chexbert import config as external_config
File "/content/drive/MyDrive/cvt2distilgpt2/config/cvt_21_to_distilgpt2_chexbert.py", line 1, in
from config.cvt_21_to_distilgpt2 import config as external_config
File "/content/drive/MyDrive/cvt2distilgpt2/config/cvt_21_to_distilgpt2.py", line 1, in
from transmodal.network.cvt import spatial_position_feature_size
File "/content/drive/MyDrive/cvt2distilgpt2/transmodal/network/cvt.py", line 27, in
class CvT(Module):
File "/content/drive/MyDrive/cvt2distilgpt2/transmodal/network/cvt.py", line 77, in CvT
def forward(self, images: torch.FloatTensor) -> Union[dict[str, Tensor], dict[str, Union[Tensor, Any]]]:
TypeError: 'type' object is not subscriptable
Please guide me through this. Thank you.
The text was updated successfully, but these errors were encountered: