Skip to content
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

TypeError: 'type' object is not subscriptable #171

Closed
sanjibnarzary opened this issue Apr 2, 2023 · 2 comments
Closed

TypeError: 'type' object is not subscriptable #171

sanjibnarzary opened this issue Apr 2, 2023 · 2 comments

Comments

@sanjibnarzary
Copy link

Traceback (most recent call last):
  File "train.py", line 25, in <module>
    import utils
  File "./fine-tuned/stanford_alpaca/utils.py", line 40, in <module>
    prompts: Union[str, Sequence[str], Sequence[dict[str, str]], dict[str, str]],
TypeError: 'type' object is not subscriptable
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 3020123) of binary: /home/sn/miniconda3/envs/chatllama/bin/python
Traceback (most recent call last):
  File "/home/sn/miniconda3/envs/chatllama/bin/torchrun", line 8, in <module>
    sys.exit(main())
  File "/home/sn/miniconda3/envs/chatllama/lib/python3.8/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
    return f(*args, **kwargs)
  File "/home/sn/miniconda3/envs/chatllama/lib/python3.8/site-packages/torch/distributed/run.py", line 794, in main
    run(args)
  File "/home/sn/miniconda3/envs/chatllama/lib/python3.8/site-packages/torch/distributed/run.py", line 785, in run
    elastic_launch(
  File "/home/sn/miniconda3/envs/chatllama/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 134, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/home/sn/miniconda3/envs/chatllama/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 250, in launch_agent    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
train.py FAILED

[TRUNCATED]
@MrRace
Copy link

MrRace commented Apr 4, 2023

@sanjibnarzary How to solve it ? Same problem!

@sanjibnarzary
Copy link
Author

@MrRace
Add Dict in line number 9 of utils.py

from typing import Optional, Sequence, Union
from typing import Optional, Sequence, Union, Dict

and replace the line number 40 with this

prompts: Union[str, Sequence[str], Sequence[Dict[str, str]], Dict[str, str]],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants