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

name 'Path' is not defined #218

Open
Learningm opened this issue Jun 29, 2023 · 2 comments
Open

name 'Path' is not defined #218

Learningm opened this issue Jun 29, 2023 · 2 comments

Comments

@Learningm
Copy link

Learningm commented Jun 29, 2023

I can run my scripts successfully, however, when I want to run kernprof -lv my_scirpt.py --parameters, this error message happened:

Wrote profile results to render.py.lprof
Traceback (most recent call last):
File "/home/anaconda3/envs/ns75/bin/kernprof", line 8, in
sys.exit(main())
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/kernprof.py", line 264, in main
execfile(script_file, ns, ns)
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/kernprof.py", line 32, in execfile
exec(compile(f.read(), filename, 'exec'), globals, locals)
File "scripts/render.py", line 428, in
entrypoint()
File "scripts/render.py", line 424, in entrypoint
tyro.cli(RenderTrajectory).main()
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_cli.py", line 177, in cli
output = _cli_impl(
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_cli.py", line 287, in _cli_impl
if not _fields.is_nested_type(cast(type, f), default_instance_internal):
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_unsafe_cache.py", line 32, in wrapped_f
out = f(*args, **kwargs)
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_fields.py", line 183, in is_nested_type
_try_field_list_from_callable(typ, default_instance),
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_fields.py", line 293, in _try_field_list_from_callable
return field_list_from_class(cls, default_instance)
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_fields.py", line 415, in _field_list_from_dataclass
for dc_field in filter(lambda field: field.init, _resolver.resolved_fields(cls)):
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_unsafe_cache.py", line 32, in wrapped_f
out = f(*args, **kwargs)
File "/home/anaconda3/envs/ns75/lib/python3.8/site-packages/tyro/_resolver.py", line 90, in resolved_fields
annotations = get_type_hints(cls, include_extras=True)
File "/home/.local/lib/python3.8/site-packages/typing_extensions.py", line 1193, in get_type_hints
hint = typing.get_type_hints(obj, globalns=globalns, localns=localns)
File "/home/anaconda3/envs/ns75/lib/python3.8/typing.py", line 1232, in get_type_hints
value = _eval_type(value, base_globals, localns)
File "/home/anaconda3/envs/ns75/lib/python3.8/typing.py", line 270, in _eval_type
return t._evaluate(globalns, localns)
File "/home/anaconda3/envs/ns75/lib/python3.8/typing.py", line 518, in _evaluate
eval(self.forward_code, globalns, localns),
File "", line 1, in
NameError: name 'Path' is not defined

I could not figure not which part matters cause I already put from pathlib import Path in the head of my scripts. Could you give me some suggestions to fix this?

@Erotemic
Copy link
Member

I don't immediately see the issue. Please provide a MWE and maybe I can help more.

@Learningm
Copy link
Author

Learningm commented Jun 30, 2023

I don't immediately see the issue. Please provide a MWE and maybe I can help more.

Actually I am profiling the open project nerfstudio, tag v0.2.2.

Sample data can be download from here.

Since it will generate a config.yml during the training process, the path inside the config.yml would not be consistent if I share this to you.

Thus, I suggest you to follow the path:
I. install nerfstudio
II. at the nerfstudio working directory, python scripts/train.py nerfacto --data data/fox --max-num-iterations 3001, reducing the max-num-iterations could save time.
III. kernprof -lv python scripts/render.py --load-config xxxxx/config.yml --output-path ./renders --output-format images

then comes the error above.
Thank you for your help.

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