turicreate icon indicating copy to clipboard operation
turicreate copied to clipboard

Style Transfer: Getting Result as a garbage on Apple M1 Silicon iMac

Open ioskevinshah opened this issue 3 years ago • 5 comments

Turicreate version: 6.4.1 Python version: 3.7 Using: Jupyter Notebook

Input image: IMG_2367

Output Garbage Image: IMG_2366

Code: import turicreate as tc

tc.config.set_num_gpus(1)

Load the style and content images styles = tc.load_images('Style/') content = tc.load_images('HumanContent/')

Create a StyleTransfer model model = tc.style_transfer.create(styles, content, max_iterations=1000, _advanced_parameters={"style_loss_mult": [1e-4, 1e-4, 1e-4, 1e-4], "pretrained_weights": True, "batch_size": 6, "finetune_all_params": True, "input_shape": (256, 256)})

Save the model for later use in Turi Create model.save('style-transfer6.model')

Export for use in Core ML model.export_coreml('MyCustomStyleTransfer6.mlmodel')

Style Zip: Style.zip

Content Zip: 500 images of human face. Content.zip

Result are same if iterations is 1k, 10k or 20k. Total Garbage.

So, I came up with this issue: https://github.com/apple/turicreate/issues/3018

They are suggesting to use CPU instead of GPU. So I did the same. tc.config.set_num_gpus(0) Kernel keep crashing/died. /// When 1 is change to 0.

Please guide me. I'm not python developer. But I was able to come up with above code by reading document and articles, their results was amazing.

ioskevinshah avatar Sep 01 '21 09:09 ioskevinshah

What do your style images look like? That can make a big difference.

The number of iterations is also important. Is there a reason you are manually setting that instead of letting the algorithms pick it?

TobyRoseman avatar Sep 01 '21 23:09 TobyRoseman

Hello @TobyRoseman,

Thanks for the quick reply.

Already attached Style.zip file. Please do check.

For iterations, I try with 1k, 10k and 20k but the result are same.

Algorithm say Apple M1 GPU 10k Iterations, result still garbage.

ioskevinshah avatar Sep 02 '21 01:09 ioskevinshah

Hello @TobyRoseman,

Did you able to reproduce? Any help from my end?

ioskevinshah avatar Sep 03 '21 11:09 ioskevinshah

Hello @TobyRoseman,

Thanks for the quick reply.

Already attached Style.zip file. Please do check.

For iterations, I try with 1k, 10k and 20k but the result are same.

Algorithm say Apple M1 GPU 10k Iterations, result still garbage.

hi ioskevinshah, I'd like to know how can you install turicreate on m1 mac? Could you please tell me ? I try some ways but not work for it. Thanks!

hacker-jerry avatar Mar 27 '22 11:03 hacker-jerry

TuriCreate does not have native M1 support. You need to use Rosetta.

TobyRoseman avatar Mar 28 '22 18:03 TobyRoseman