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: expected string or bytes-like object #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shinra1012
Copy link

when I try to run using style_mix like given example I got
TypeError: expected string or bytes-like object .
I print the input:s of num_range function. I find it may get a list and raise the error.
I haven't found out when it happened (num_range function get a list),but simply change makes it work.

when I try to run using style_mix like given example I got 
TypeError: expected string or bytes-like object .
I print the input:s of num_range function. I find  it may get a list and raise the error.
I haven't found out when it happened (num_range function get a list),but simply change makes it work.
@hungtooc
Copy link

same here

$ python style_mixing.py --outdir=out --rows=85,100,75,458,1500 --cols=55,821,1789,293     --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/metfaces.pkl
Traceback (most recent call last):
  File "style_mixing.py", line 116, in <module>
    generate_style_mix() # pylint: disable=no-value-for-parameter
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 1061, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 923, in make_context
    self.parse_args(ctx, args)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 1379, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 2364, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 2320, in process_value
    value = self.type_cast_value(ctx, value)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/core.py", line 2307, in type_cast_value
    return convert(value)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/types.py", line 75, in __call__
    return self.convert(value, param, ctx)
  File "/home/ubuntu/anaconda3/envs/env_hung98_model/lib/python3.6/site-packages/click/types.py", line 170, in convert
    return self.func(value)
  File "style_mixing.py", line 29, in num_range
    m = range_re.match(s)
TypeError: expected string or bytes-like object

@rkuo2000
Copy link

rkuo2000 commented Sep 14, 2021

I have figured it out, rows has 1 extra number than cols, my fix is below:
python style_mixing.py --outdir=out --rows=85,100,458,1500 --cols=55,821,1789,293 \ --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/metfaces.pkl

check out my kaggle code https://www.kaggle.com/rkuo2000/stylegan2-ada

@Zhang-JiahangH
Copy link

I met a problem when install:

Installing collected packages: alphaction
Running setup.py develop for alphaction
ERROR: Command errored out with exit status 1:
command: /home/jiahang/anaconda3/envs/alphaction/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jiahang/AlphAction/setup.py'"'"'; file='"'"'/home/jiahang/AlphAction/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps
cwd: /home/jiahang/AlphAction/
Complete output (45 lines):
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda-11.6'
running develop
running egg_info
writing alphaction.egg-info/PKG-INFO
writing dependency_links to alphaction.egg-info/dependency_links.txt
writing requirements to alphaction.egg-info/requires.txt
writing top-level names to alphaction.egg-info/top_level.txt
reading manifest file 'alphaction.egg-info/SOURCES.txt'
writing manifest file 'alphaction.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "", line 1, in
File "/home/jiahang/AlphAction/setup.py", line 121, in
cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/setuptools/command/develop.py", line 114, in install_for_development
self.run_command('build_ext')
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 410, in build_extensions
self._check_cuda_version()
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 783, in _check_cuda_version
torch_cuda_version = packaging.version.parse(torch.version.cuda)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/version.py", line 56, in parse
return Version(version)
File "/home/jiahang/anaconda3/envs/alphaction/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/version.py", line 275, in init
match = self._regex.search(version)
TypeError: expected string or bytes-like object
----------------------------------------
ERROR: Command errored out with exit status 1: /home/jiahang/anaconda3/envs/alphaction/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jiahang/AlphAction/setup.py'"'"'; file='"'"'/home/jiahang/AlphAction/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

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

Successfully merging this pull request may close these issues.

4 participants