Skip to content

How to load pretrained models? #3

@vonum

Description

@vonum

How are we supposed to use the pretrained models linked in the docs?
https://drive.google.com/drive/folders/1-ywa__KcK4uEEYOzgfeRCpCzP3RJKBwL

The main.py evaluate works only with the weights.index file of any model, but those weights are not good, you get noise basically. Loading any other weight leads to:

python main.py evaluate    \
  --weights weights/aquarelle/weights.data-00001-of-00002 \
  --content images/content/stata.jpg \
  --result images/results/result.jpg

Results in:

2021-09-12 20:12:00.189751: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open weights/aquarelle/weights.data-00001-of-00002: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
Traceback (most recent call last):
  File "main.py", line 119, in <module>
    main()
  File "main.py", line 111, in main
    transfer(**parameters)
  File "/home/vonum/code/ml/FastStyle/evaluate.py", line 14, in transfer
    network.load_weights(weights).expect_partial()
  File "/home/vonum/Envs/fast-style/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2348, in load_weights
    with h5py.File(filepath, 'r') as f:
  File "/home/vonum/Envs/fast-style/lib/python3.8/site-packages/h5py/_hl/files.py", line 424, in __init__
    fid = make_fid(name, mode, userblock_size,
  File "/home/vonum/Envs/fast-style/lib/python3.8/site-packages/h5py/_hl/files.py", line 190, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 96, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions