k-l-lambda / stylegan-web

A web porting for NVlabs' StyleGAN.
159 stars 41 forks source link

I get noise only #12

Open mykeehu opened 3 months ago

mykeehu commented 3 months ago

I installed this app under windows, setup everything, but I get this noise for any model. What's happened?

image

I have RTX 3060, is this compatible?

k-l-lambda commented 3 months ago

Try run python ./test.py, then check images/example.png. If it is also noise, that maybe due to your model weight files' problem.

mykeehu commented 3 months ago

This is very interesting, because the sample picture is perfect. So what is the problem? example

k-l-lambda commented 3 months ago

Try to replace this line in file http_server.py:

    image.save(fp, PIL.Image.registered_extensions()['.png'])

with:

    image.save('./test.png')

And see if the output is normal.

mykeehu commented 2 months ago

Unfortunately it didn't help, now a white image is saved, although the console says there is data in it.

generation cost: 0.3530001640319824
127.0.0.1 - - [10/Apr/2024 07:11:46] "GET /generate?psi=0.5&randomize_noise=1&latents=Y%2FYpPQcE3Dy2EuC8Q%2F2WPfEB6Tqv1xQ9DA6QPXvmBj5pu4i7wK4mvS660TulpoS9JTk5vXp6Hb2MErs9TOaqvbISDTrRiFi8m9rpPCnwij2ibo67JSRRPQKO2TzGVum9Ch6WvK2CVjy0zhE9kQBGPC%2FVDT15lQG9e+meu41QkT1LCrS8GdjUvDbtkL0XIZS9UTTGPAIMN71pQj07tlTNPNHZij3LO6Y8tc0qPRhp1rsaWdc78pPwvNjrsTx4YgS9PtiIvVHpF73nCCo9IXqzuvp%2F77yBv148kuH8ugGXKj3Xhp67dtGwu4Yj1LxNwVO8I7abvHPAYDyHd0K8Ls%2FqPIdb3zscjvQ8khLGvLdQVD2Xj6c8XYmCvW+merw5eJs9Gop2PXFRZ7z1f0Q9XWq2PA1xDD0dtES93PGAvAIPDj3BhPm8Q+BGPBZbEbt2aVq9jv8su9kM6LzWRvK8juvWvdLoL700zva8rXSIu03EBr448FU72vcVvclBQT0jP6M8C+0mPfTrdb2EXS47folhPFp8aLxCQQO95ksOPRiALD076TI8grILvTWt1Dshkbo9cvtIvXsqHz33uKQ8XE7RPYKnbLyD+Sc9mmWAvRL3d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.1" 200 -
k-l-lambda commented 2 months ago

So, did you see the image of test.png?

mykeehu commented 2 months ago

Yes, png file has generated, but white only.

I use this in .env.local

MODEL_NAME=ffhq
MODEL_PATH_ffhq=./models/stylegan2-ffhq-config-a.pkl

This is the default generated image I get after loading the model: test

127.0.0.1 - - [10/Apr/2024 07:20:42] "GET /generate?psi=0.5&randomize_noise=1&latents=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%3D HTTP/1.1" 200 -

mykeehu commented 2 months ago

I reinstalled venv with Flask 1.1.1 (it was version 2), but it won't start after that:

Traceback (most recent call last):
  File "I:\stylegan-web\http_server.py", line 7, in <module>
    import flask
  File "I:\stylegan-web\venv\lib\site-packages\flask\__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (I:\stylegan-web\venv\lib\site-packages\jinja2\__init__.py)
k-l-lambda commented 2 months ago

stylegan2-ffhq-config-a.pkl seems not the final weight file of stylegan2. And zero latent should generate an average face for ffhq, this is not right.

mykeehu commented 2 months ago

I use this requirements.txt for perfect install:

tensorflow-gpu==1.14.0
python-dotenv>=0.10.1
Flask
numpy>=1.8.0
Pillow>=6.0.0
requests>=2.21.0
protobuf<3.20

And models from here (from gdrive), this has not changed in four years.: https://github.com/NVlabs/stylegan2/blob/master/pretrained_networks.py

mykeehu commented 2 months ago

What I don't understand is why, if the test runs correctly (I have replaced the model), the generator doesn't take a good picture.

Update1: Progress: the base image came in after some waiting, but when I click on the Randomize button, colourful things appear.

k-l-lambda commented 2 months ago

What I don't understand is why, if the test runs correctly (I have replaced the model), the generator doesn't take a good picture.

Update1: Progress: the base image came in after some waiting, but when I click on the Randomize button, colourful things appear.

test.py use the weight file of stylegan2-ffhq-config-f.pkl, try that.

mykeehu commented 2 months ago

We are making progress. The sample image is already displayed, but whenever I change any of the parameters, I get colored noise:

image

image

k-l-lambda commented 2 months ago

We are making progress. The sample image is already displayed, but whenever I change any of the parameters, I get colored noise:

image

image

Right click the bad image, open in a new tab. Then restart python server, and refresh image page. Check if it change.

mykeehu commented 2 months ago

@k-l-lambda this trick works, i.e. if I refresh the image based on URL, the image is displayed instead of the noise.

k-l-lambda commented 2 months ago

It seems your hardware's problem. RTX3060's graph memory may be not enough. However you can try his 256x256 models, such as cat and horse.

mykeehu commented 2 months ago

Is it possible that the RTX 3090 card is not supported by one of the requirements components? I'll look at the cat and the horse in a moment.

Here is my cmd log:

I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From I:\stylegan-web\venv\lib\site-packages\tensorflow\python\compat\v2_compat.py:61: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
 * Serving Flask app 'http_server'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8186
Press CTRL+C to quit
127.0.0.1 - - [11/Apr/2024 09:42:47] "GET / HTTP/1.1" 304 -
127.0.0.1 - - [11/Apr/2024 09:42:47] "GET /bundles/index.bundle.js HTTP/1.1" 304 -
Initializing dnnlib...
Loading model cat ...
Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Loading... Done.
Setting up TensorFlow plugin "upfirdn_2d.cu": Preprocessing... Loading... Done.
127.0.0.1 - - [11/Apr/2024 09:43:07] "GET /spec HTTP/1.1" 200 -
generation cost: 103.58478116989136
127.0.0.1 - - [11/Apr/2024 09:44:51] "GET /generate?psi=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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%3D HTTP/1.1" 200 -

and result by default, but there, too, I change anything, and then there's colored noise: image

image

k-l-lambda commented 2 months ago

Maybe you can try to disable cuda inference by set env CUDA_VISIBLE_DEVICES=-1, see if it works.

mykeehu commented 2 months ago

The -1 was no good, I used zero, but the problem persists. However, with the PYTORCH_CUDA_ALLOC_CONF parameterization, the initial image also changed (became noisy), so I'll see if something can be done about that: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars https://pytorch.org/docs/stable/notes/cuda.html#environment-variables

k-l-lambda commented 2 months ago

What do you mean by 'no good'? Any errors?

mykeehu commented 2 months ago

Yes, I've got an error. Does tensorflow not support my card?

I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
I:\stylegan-web\venv\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From I:\stylegan-web\venv\lib\site-packages\tensorflow\python\compat\v2_compat.py:61: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
 * Serving Flask app 'http_server'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8186
Press CTRL+C to quit
127.0.0.1 - - [11/Apr/2024 10:22:35] "GET / HTTP/1.1" 304 -
127.0.0.1 - - [11/Apr/2024 10:22:35] "GET /bundles/index.bundle.js HTTP/1.1" 304 -
Initializing dnnlib...
2024-04-11 10:22:35.196453: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
Loading model cat ...
Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed!
[2024-04-11 10:22:36,850] ERROR in app: Exception on /spec [GET]
Traceback (most recent call last):
  File "I:\stylegan-web\venv\lib\site-packages\flask\app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "I:\stylegan-web\venv\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "I:\stylegan-web\venv\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "I:\stylegan-web\venv\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "http_server.py", line 154, in spec
    model, _ = loadGs()
  File "http_server.py", line 61, in loadGs
    Gi, Di, Gs = pickle.load(f)
  File "I:\stylegan-web\dnnlib\tflib\network.py", line 303, in __setstate__
    self._init_graph()
  File "I:\stylegan-web\dnnlib\tflib\network.py", line 154, in _init_graph
    out_expr = self._build_func(*self.input_templates, **build_kwargs)
  File "<string>", line 492, in G_synthesis_stylegan2
  File "<string>", line 456, in layer
  File "<string>", line 100, in modulated_conv2d_layer
  File "<string>", line 69, in apply_bias_act
  File "I:\stylegan-web\dnnlib\tflib\ops\fused_bias_act.py", line 68, in fused_bias_act
    return impl_dict[impl](x=x, b=b, axis=axis, act=act, alpha=alpha, gain=gain)
  File "I:\stylegan-web\dnnlib\tflib\ops\fused_bias_act.py", line 122, in _fused_bias_act_cuda
    cuda_kernel = _get_plugin().fused_bias_act
  File "I:\stylegan-web\dnnlib\tflib\ops\fused_bias_act.py", line 16, in _get_plugin
    return custom_ops.get_plugin(os.path.splitext(__file__)[0] + '.cu')
  File "I:\stylegan-web\dnnlib\tflib\custom_ops.py", line 133, in get_plugin
    compile_opts += ' --gpu-architecture=%s' % _get_cuda_gpu_arch_string()
  File "I:\stylegan-web\dnnlib\tflib\custom_ops.py", line 55, in _get_cuda_gpu_arch_string
    raise RuntimeError('No GPU devices found')
RuntimeError: No GPU devices found
127.0.0.1 - - [11/Apr/2024 10:22:36] "GET /spec HTTP/1.1" 500 -
127.0.0.1 - - [11/Apr/2024 10:22:36] "GET /favicon.ico HTTP/1.1" 304 -
k-l-lambda commented 2 months ago

Ok, I forgot stylegan2 has some cuda modules, so it cannot run on cpu. Ignore this advice.

mykeehu commented 2 months ago

I'm not a programmer, but the error looks like it doesn't call the generation after setting the parameters, but tries to modify it from cahce, and it can't read it properly. Would it be a Flask error?

k-l-lambda commented 2 months ago

I'm not a programmer, but the error looks like it doesn't call the generation after setting the parameters, but tries to modify it from cahce, and it can't read it properly. Would it be a Flask error?

I don't known. I guess it may be a bug within cuda. Try run nvidia-smi and find your nvidia driver version. Probably version number of driver or cuda or cudnn is out of date.

mykeehu commented 2 months ago

Everything is up to date, and of course several versions of CUDA are installed. For CUDA versions, the corresponding cuDNN is downloaded and installed.

My VC path is correct in custom_ops.py: compiler_bindir_search_path = [ 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64',

'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64',

#'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64',
#'C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64',
#'C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin',

+-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 551.86 Driver Version: 551.86 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 3090 WDDM | 00000000:01:00.0 On | N/A | | 65% 67C P2 160W / 350W | 7889MiB / 24576MiB | 35% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+