CJOGIST / stylegan_notebook

0 stars 1 forks source link

jupyter notebook code error #4

Open BreadMoon opened 3 years ago

BreadMoon commented 3 years ago
  1. 모든 Keras. 모듈을 tensorflow.keras로 바꾸기
  2. apt-get update
  3. pip install opencv-python
BreadMoon commented 3 years ago

!python encode_images.py --optimizer=lbfgs --face_mask=True --iterations=6 --use_lpips_loss=0 --use_discriminator_loss=0 --output_video=True aligned_images/ generated_images/ latent_representations/ print("\n************ Latent code optimization finished! ***************")

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

apt-get install libgl1-mesa-glx

BreadMoon commented 3 years ago

OSError: Google Drive quota exceeded

원격 접속으로 파일 직접 받아 해결, Notion에 업로드 하겠음

BreadMoon commented 3 years ago

encode_images.py parser.add_argument('--model_url', default='https://drive.google.com/uc?id=1MEGjdvVpUsu1jB4zrXZN7Y4kBBOzizDQ', help='Fetch a StyleGAN model to train on from this URL') # default값 변경 https://drive.google.com/file/d/1CA7bap7-XHpU5p59zfOAxqy4QMoF4MnE/view?usp=sharing

BreadMoon commented 3 years ago

2021-09-10 04:00:09.852414: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_INVALID_DEVICE: invalid device ordinal Traceback (most recent call last): File "encode_images.py", line 242, in main() File "encode_images.py", line 117, in main generator_network, discriminator_network, Gs_network = pickle.load(f) _pickle.UnpicklingError: invalid load key, '\x0a'.

**** Latent code optimization finished! ***

cuda issue, picle.load() issue

BreadMoon commented 3 years ago
  1. /encode_images.py with dnnlib.util.open_url(args.model_url, cache_dir=config.cache_dir) as f: generator_network, discriminator_network, Gs_network = pickle.load(f)

  2. /dnnlb/util.py

    • open_url method if cache_dir is not None: safe_name = re.sub(r"[^0-9a-zA-Z-._]", "_", url_name) cache_file = os.path.join(cache_dir, url_md5 + "_" + safe_name) temp_file = os.path.join(cache_dir, "tmp_" + uuid.uuid4().hex + "_" + url_md5 + "_" + safe_name) os.makedirs(cache_dir, exist_ok=True) with open(temp_file, "wb") as f: f.write(url_data) os.replace(temp_file, cache_file) # atomic

위 코드에서 error 발생.