Skip to content

Commit a25b026

Browse files
author
onion
committed
chore: iOS model loading startup item adjustment
1 parent 30550b9 commit a25b026

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

composeApp/src/commonMain/kotlin/org/onion/diffusion/viewmodel/ChatViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ class ChatViewModel : ViewModel() {
8484
var wtype = mutableStateOf(-1)
8585

8686
/** Offload to CPU - offload model computations to CPU */
87-
var offloadToCpu = mutableStateOf(false)
87+
var offloadToCpu = mutableStateOf(getPlatform().isIOS)
8888

89-
/** Keep CLIP on CPU - keep CLIP model on CPU (enabled by default on macOS) */
90-
var keepClipOnCpu = mutableStateOf(getPlatform().isMacOS)
89+
/** Keep CLIP on CPU - keep CLIP model on CPU (enabled by default on macOS and iOS) */
90+
var keepClipOnCpu = mutableStateOf(getPlatform().isMacOS || getPlatform().isIOS)
9191

9292
/** Keep VAE on CPU - keep VAE decoder on CPU */
9393
var keepVaeOnCpu = mutableStateOf(false)

shared/src/commonMain/kotlin/org/onion/diffusion/Platform.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.onion.diffusion
33
interface Platform {
44
val name: String
55
val isMacOS: Boolean get() = false
6+
val isIOS: Boolean get() = false
67
}
78

89
expect fun getPlatform(): Platform

shared/src/iosMain/kotlin/org/onion/diffusion/Platform.ios.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import platform.UIKit.UIDevice
44

55
class IOSPlatform: Platform {
66
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
7+
override val isIOS: Boolean = true
78
}
89

910
actual fun getPlatform(): Platform = IOSPlatform()

0 commit comments

Comments
 (0)