Archive for December 2, 2022

Friday, December 2, 2022

Stable Diffusion With Core ML on Apple Silicon

Apple (Hacker News):

Today, we are excited to release optimizations to Core ML for Stable Diffusion in macOS 13.1 and iOS 16.2, along with code to get started with deploying to Apple Silicon devices.

[…]

Beyond image generation from text prompts, developers are also discovering other creative uses for Stable Diffusion, such as image editing, in-painting, out-painting, super-resolution, style transfer and even color palette generation.

[…]

To learn more about how we optimized a model of this size and complexity to run on the Apple Neural Engine, you can check out our previous article on Deploying Transformers on the Apple Neural Engine. The optimization principles outlined in the article generalize to Stable Diffusion despite the fact that it is 19x larger than the model studied in the previous article. Optimizing Core ML for Stable Diffusion and simplifying model conversion makes it easier for developers to incorporate this technology in their apps in a privacy-preserving and economically feasible way, while getting the best performance on Apple Silicon.

Core ML Stable Diffusion:

This repository comprises:

  • python_coreml_stable_diffusion, a Python package for converting PyTorch models to Core ML format and performing image generation with Hugging Face diffusers in Python
  • StableDiffusion, a Swift package that developers can add to their Xcode projects as a dependency to deploy image generation capabilities in their apps. The Swift package relies on the Core ML model files generated by python_coreml_stable_diffusion

An M2 MacBook Air is significantly faster than an M1 Pro MacBook Pro.

Previously:

Coinbase Wallet NFT Transfers Blocked From App Store

Coinbase (Hacker News):

You might have noticed you can’t send NFTs on Coinbase Wallet iOS anymore. This is because Apple blocked our last app release until we disabled the feature.

Apple’s claim is that the gas fees required to send NFTs need to be paid through their In-App Purchase system, so that they can collect 30% of the gas fee.

For anyone who understands how NFTs and blockchains work, this is clearly not possible. Apple’s proprietary In-App Purchase system does not support crypto so we couldn’t comply even if we tried.

This is akin to Apple trying to take a cut of fees for every email that gets sent over open Internet protocols.

Note that, even with IAP, apps aren’t allowed to use NFTs to unlock content. So they only have value outside of the app/device. Normally that’s where IAP restrictions don’t apply. You don’t have to use IAP to transfer funds using Venmo or your banking app. You can also use apps to trade stocks without paying Apple 30% of the brokerage’s fee.

Previously:

Study on Research Code Quality and Execution

Ana Trisovic et al. (via Ethan Mollick):

Research code is typically created by a group of scientists and published together with academic papers to facilitate research transparency and reproducibility. For this study, we define ten questions to address aspects impacting research reproducibility and reuse. First, we retrieve and analyze more than 2000 replication datasets with over 9000 unique R files published from 2010 to 2020. Second, we execute the code in a clean runtime environment to assess its ease of reuse. Common coding errors were identified, and some of them were solved with automatic code cleaning to aid code execution. We find that 74% of R files failed to complete without error in the initial execution, while 56% failed when code cleaning was applied, showing that many errors can be prevented with good coding practices. We also analyze the replication datasets from journals’ collections and discuss the impact of the journal policy strictness on the code re-execution rate.

iPhone 14 Repair Changes

Kevin Purdy:

While the iPhone 14 hardware lineup costs largely the same as the previous generation, the cost of replacing the battery has gone up considerably, surpassing the prices Apple was charging before its 2016/2017 “Batterygate” reckoning.

Replacing the battery in any of the iPhone 14 models will cost $99, up from the $69 Apple charges for the 13, 12, 11, and X lines. The newest iPhone SE and iPhones in the 8 and older series cost $49.

Joe Rossignol:

This is a 43% increase to the fee, which includes the cost of a new battery and service by an Apple Store or an Apple Repair Center. iPhone battery replacement fees will vary at third-party Apple Authorized Service Providers.

[…]

Apple’s out-of-warranty service fees have also increased for select other iPhone 14 repairs. For example, in the U.S., Apple charges $379 to fix cracked glass on an iPhone 14 Pro Max’s display, compared to $329 for the same repair on an iPhone 13 Pro Max.

Benjamin Mayo (Hacker News):

As evidenced in this iFixit teardown, Apple has made it much easier to repair the back glass panel. The back glass can now be removed independently of the logic board, making repairs much cheaper. Previously, only the front glass was separably removable. And, it seems Apple is also passing this cost savings onto consumers…

Kyle Wiens:

We are hearing reports that Apple is continuing their hostile path of pairing parts to the phone, requiring activation of the back glass after installation. You really shouldn’t need Apple’s permission to install a sheet of glass on a phone that you already own.

Previously: