π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update inference download formatting
Prateek Sunal5559bc533d19
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/InferenceRsProvider.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/InferenceRsProvider.swiftindex 87e94d7660..397ac5df84 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Services/InferenceRsProvider.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/InferenceRsProvider.swift@@ -114,9 +114,9 @@ final class InferenceRsProvider {}let status = if hasTotal {- "Downloading... \(self.formatBytes(overallDownloaded)) / \(self.formatBytes(totalBytes))"+ "Downloading... \(overallDownloaded.formattedFileSize) / \(totalBytes.formattedFileSize)"} else {- "Downloading \(download.label.lowercased())... \(self.formatBytes(downloaded))"+ "Downloading \(download.label.lowercased())... \(downloaded.formattedFileSize)"}onProgress(InferenceDownloadProgress(percent: min(99, max(0, percent)), status: status))@@ -149,6 +149,7 @@ final class InferenceRsProvider {}let mmprojPath = imageFiles.isEmpty ? nil : mmprojPathFor(target: target)?.path+ let clampedTemperature = min(max(temperature, 0.35), 0.7)let request = GenerateChatRequest(messages: nativeMessages,@@ -158,12 +159,12 @@ final class InferenceRsProvider {mmprojPath: mmprojPath,mediaMarker: nil,maxTokens: Int32(maxTokens),- temperature: temperature,- topP: nil,- topK: nil,- repeatPenalty: nil,- frequencyPenalty: nil,- presencePenalty: nil,+ temperature: clampedTemperature,+ topP: 0.9,+ topK: 50,+ repeatPenalty: 1.18,+ frequencyPenalty: 0,+ presencePenalty: 0,seed: nil,stopSequences: nil,grammar: nil@@ -485,12 +486,6 @@ final class InferenceRsProvider {return header == "GGUF"}- private func formatBytes(_ bytes: Int64) -> String {- let formatter = ByteCountFormatter()- formatter.countStyle = .file- return formatter.string(fromByteCount: bytes)- }-private func modelPathFor(target: InferenceModelTarget) -> URL {let base = modelDir.appendingPathComponent("models", isDirectory: true)let filename = URL(string: target.url)?.lastPathComponent ?? "model.gguf"diff --git a/mobile/native/darwin/Apps/ensu/ensu/Utils/ByteFormatting.swift b/mobile/native/darwin/Apps/ensu/ensu/Utils/ByteFormatting.swiftnew file mode 100644index 0000000000..c5899888c4--- /dev/null+++ b/mobile/native/darwin/Apps/ensu/ensu/Utils/ByteFormatting.swift@@ -0,0 +1,15 @@+import Foundation++extension ByteCountFormatter {+ static let fileSizeFormatter: ByteCountFormatter = {+ let formatter = ByteCountFormatter()+ formatter.countStyle = .file+ return formatter+ }()+}++extension Int64 {+ var formattedFileSize: String {+ ByteCountFormatter.fileSizeFormatter.string(fromByteCount: self)+ }+}