I'm downloading a fine-tuned model from HuggingFace which is then cached on my Mac when the app first starts. However, I wanted to test adding a progress bar to show the download progress. To test this I need to delete the cached model. From what I've seen online this is cached at
/Users/userName/.cache/huggingface/hub
However, if I delete the files from here, using Terminal, the app still seems to be able to access the model.
Is the model cached somewhere else?
On my iPhone it seems deleting the app also deletes the cached model (app data) so that is useful.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I have used mlx_lm.lora to fine tune a mistral-7b-v0.3-4bit model with my data. I fused the mistral model with my adapters and upload the fused model to my directory on huggingface. I was able to use mlx_lm.generate to use the fused model in Terminal. However, I don't know how to load the model in Swift. I've used
Imports
import SwiftUI
import MLX
import MLXLMCommon
import MLXLLM
let modelFactory = LLMModelFactory.shared
let configuration = ModelConfiguration(
id: "pharmpk/pk-mistral-7b-v0.3-4bit"
)
// Load the model off the main actor, then assign on the main actor
let loaded = try await modelFactory.loadContainer(configuration: configuration)
{ progress in
print("Downloading progress: \(progress.fractionCompleted * 100)%")
}
await MainActor.run {
self.model = loaded
}
I'm getting an error
runModel error: downloadError("A server with the specified hostname could not be found.")
Any suggestions?
Thanks, David
PS, I can load the model from the app bundle
// directory: Bundle.main.resourceURL!
but it's too big to upload for Testflight
Topic:
Machine Learning & AI
SubTopic:
General
I have a Chart displaying Counts per Date over 2-3 years. I'd like to have the XAxis mark consist of MM-yy or even MM/nyy. Is this possible?
OK, just saw
AxisValueLabel(format: .dateTime.month().year())
which gives e.g. Mar 2024. This is good.
Better might be Mar 24 (maybe a Y3K problem ;-) or even better
Mar. OR Mar
24. 2024
Or best increment the year when it changes.
Are any of these alternate formats possible?
Thanks, David
PS, my current .chartXAxis code
.chartXAxis {
AxisMarks(values: .stride(by: .month, count: 3)) { value in
if value.as(Date.self) != nil {
AxisValueLabel(format: .dateTime.month().year())
AxisGridLine()
AxisTick()
}
}
}
I'm importing a csv file of 299 rows and creating a subset by filtering on one column value (24 rows). I want to Chart just the filtered values. However, when I print one column I get values from the original dataFrame. Any suggestions? Thanks, David
The code:
import SwiftUI
import Charts
import TabularData
struct DataPoint: Identifiable {
var id = UUID() // This makes it conform to Identifiable
var date: Date
var value: Double
}
struct ContentView: View {
@State private var dataPoints: [DataPoint] = []
var body: some View {
Text("Hello")
Chart {
ForEach(dataPoints) { dataPoint in
PointMark(
x: .value("Date", dataPoint.date),
y: .value("Value", dataPoint.value)
)
}
}
.frame(height: 300)
.padding()
.onAppear(perform: loadData)
}
func loadData() {
print("In Loading Data")
// Load the CSV file
if let url = Bundle.main.url(forResource: "observations", withExtension: "csv") {
do {
let options = CSVReadingOptions(hasHeaderRow: true, delimiter: ",")
var data0 = try DataFrame(contentsOfCSVFile: url, options: options)
let formattingOptions = FormattingOptions(
maximumLineWidth: 200,
maximumCellWidth: 15,
maximumRowCount: 30
)
// print(data0.description(options: formattingOptions))
print("Number of Columns: \(data0.columns.count)")
let columnsSet = ["plant_id", "date", "plot", "plantNumber", "plantCount"]
data0 = try DataFrame(contentsOfCSVFile:url, columns: columnsSet, options: options)
print("Number of Columns (after columnsSet): \(data0.columns.count)")
print("Printing data0")
print(data0.description(options: formattingOptions))
let data = data0.filter { $0["plant_id"] as? Int == 15 }
print("Printing data")
print(data.description(options: formattingOptions))
print(" Number of Rows \(data.rows.count)")
for i in 0 ... data.rows.count {
// print("\(i): \(data["plantCount"][i]!)")
if let plantCount = data["plantCount"][i] as? Int {
print("\(i): \(plantCount)")
} else {
print("\(i): Value not found or invalid type")
}
}
//
// var newDataPoints: [DataPoint] = []
// Here I plan to add the filtered data to DataPoint
//
DispatchQueue.main.async {
dataPoints = newDataPoints
}
} catch {
print("Error reading CSV file: \(error)")
}
}
else
{
print("Didn't load csv file")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Here is the new dataFrame and print output
Printing data
┏━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ ┃ plant_id ┃ date ┃ plot ┃ plantNumber ┃ plantCount ┃
┃ ┃ <Int> ┃ <String> ┃ <Int> ┃ <Int> ┃ <Int> ┃
┡━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 0 │ 15 │ 2023-09-07 │ 1 │ 5 │ 5 │
│ 32 │ 15 │ 2023-09-07 │ 2 │ 10 │ 10 │
│ 38 │ 15 │ 2023-09-07 │ 2 │ 20 │ 20 │
│ 66 │ 15 │ 2023-09-07 │ 4 │ 25 │ 25 │
│ 77 │ 15 │ 2023-09-07 │ 5 │ 5 │ 5 │
│ 99 │ 15 │ 2023-09-14 │ 7 │ 45 │ 45 │
│ 142 │ 15 │ 2024-05-30 │ 1 │ 20 │ 20 │
│ 162 │ 15 │ 2024-05-30 │ 4 │ 5 │ 5 │
│ 169 │ 15 │ 2024-05-30 │ 5 │ 10 │ 10 │
│ 175 │ 15 │ 2024-05-30 │ 7 │ 10 │ 10 │
│ 188 │ 15 │ 2024-07-11 │ 1 │ 20 │ 40 │
│ 199 │ 15 │ 2024-07-11 │ 2 │ 5 │ 5 │
│ 215 │ 15 │ 2024-07-11 │ 5 │ 20 │ 30 │
│ 220 │ 15 │ 2024-07-11 │ 7 │ 30 │ 40 │
│ 236 │ 15 │ 2024-09-06 │ 1 │ 20 │ 60 │
│ 238 │ 15 │ 2024-09-06 │ 2 │ 30 │ 35 │
│ 248 │ 15 │ 2024-09-06 │ 5 │ 5 │ 35 │
│ 254 │ 15 │ 2024-09-06 │ 7 │ 50 │ 90 │
│ 267 │ 15 │ 2025-05-04 │ 1 │ 10 │ 70 │
│ 273 │ 15 │ 2025-05-04 │ 2 │ 10 │ 45 │
│ 282 │ 15 │ 2025-05-04 │ 5 │ 10 │ 45 │
│ 287 │ 15 │ 2025-05-04 │ 7 │ 30 │ 120 │
│ 292 │ 15 │ 2025-05-04 │ 8 │ 10 │ 0 │
│ 297 │ 15 │ 2925-05-04 │ 3 │ 10 │ 0 │
└─────┴──────────┴────────────┴───────┴─────────────┴────────────┘
24 rows, 5 columns
Number of Rows 24
0: 5
1: 80
2: 1
3: 1
4: 1
5: 3
6: 3
7: 1
8: 6
9: 1
10: 1
11: 1
12: 1
13: 10
14: 50
15: 1
16: 2
17: 1
18: 3
19: 8
20: 5
21: 3
22: 7
23: 2
24: 1
I'm developing a tutorial style tvOS app with multiple videos. The examples I've seen so far deal with only one video.
Defining the player and source(url) before body view
let avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../video.mp4")!))
and then in the body view the video is displayed
VideoPlayer(player: avPlayer)
This allows options such as stop/start etc.
When I try something similar with a video title passed into this view I can't define the player with this title variable.
var vTitle: String
var avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../" + vTitle + ".mp4"")!))
var body: some View {
I het an error that vTitle can't be used in the url above the body view.
Any thoughts or suggestions? Thanks
I have a TVML style app on the app store that no longer seems to work. I'm working on converting it to SwiftUI after seeing the WWDC video "Migrate your TVML app to SwiftUI".
I've got most of the code working up until I'm trying to display video from a remote source (my website). It looks like the network connection is blocked, maybe.
On a macOS app I see a App Sandbox capabilities that include Network access. I don't see that option for the tvOS app. Am I missing something or is it not needed, and I should look elsewhere?
Thanks, David
What do I need to do with my webpages to enable Safari AI summary functionality?
Thanks, David
The actual error:
pkgbuild: error: Could not find appropriate signing identity for “Developer ID installer: My Name (DeveloperID)”.
I'm trying to sign a program written with gfortran. The steps worked the last time (Mar 23) I built this code.
The steps to error:
a) xcrun notarytool store-credentials --apple-id "xxx" --team-id "yyy"
Giving Profile Name zzz and App-specific password
b) codesign --force --timestamp --options=runtime -s "Developer ID Application: My Name (yyy)" AppName
c) pkgbuild --root ROOT --identifier org.aaa.bbb --version "1.1.1" --sign "Developer ID installer: My Name (yyy)" AppName.pkg
ROOT contains the package contents
At this point I get the error
pkgbuild: error: Could not find appropriate signing identity for “Developer ID installer: My Name (yyy)”
Are there steps that have changed. Any suggestions?
Thanks, David
What is the best way to demonstrate or create 2D video to demonstrate an immersive video app? So far I've shared the AVP to my desktop Mac and screen captured the resulting view. Rather shaky at times. With visionOS 2.0 beta (2) is there a better way?
Thanks, David
I'm just starting with Immersive Spaces. I am able to view one immersive space but when I tried to open a different one (after restarting the app) I got an error that only one space can be opened (at a time). I added
before the openImmersiveSpace call. Now I see a warning shown in the post title. That is
Unable to dismiss an Immersive Space since none is opened
The app still works but it would be nice to detect when a Space is open so I could check and only close the 'old' space when present before opening the 'new' space.
Any suggestions? Thanks.
David
In a tvOS app I have two buttons and would like to determine which one has focus when selected. Using func pressesBegan works for nw.
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
guard let selected = UIScreen.main.focusedItem else { return }
Xcode tells me that focusedItem is deprecated and I should use -[UIWindowScene focusSystem].focusedItem instead. Any suggestions on a code snippet that could be used.
Thanks
Is it possible to remove/reset GmeCenter scores for my game app? I'd like to remove all scores so new users can start to compete. Is this possible? The games are educationally based and I'fd like to reset score for a new class.
I installed Sonoma beta on my personal laptop and I find it set-up with a profile. This profile seems to prevent logging into iCloud when started up FreeForm. A bug or something I can fix?
Thanks, David
I'm using Xcode 14.1 to start a Core Data project. I created a new Project, checking CoreData. The resulting program works in Preview and in the Simulator.
I've changed the data from a Item/timestamp to Locations/title. I plan to add more Attributes but that's for later.
I think I've got all the Item instances changed to Locations and timestamp to title. It seems to work OK when in Preview for ContentView.swift but crashes in the Simulator with the error
Swift/UnsafeRawBufferPointer.swift:946: Fatal error: UnsafeRawBufferPointer with negative count
Any suggestions on what I have done wrong? Thanks.
PS, the New Project includes the line Text("Select a location") but Select a location doesn't appear in the Preview.
I was able have an app transferred from another AppleID to my personal AppleID. The transfer seemed to go OK (https://help.apple.com/app-store-connect/#/deved688524f) however there seems to be a problem now when I try to update the app. I've changed 'ownership' where I can see but when I uploaded the new version, the old bundleID no longer matches my new AppleID format.
Do I keep the old bundleID? I'd prefer not delete and recreate the app. That was why I chose the transfer method.
Any suggestions, thanks,. David
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App ID
App Store Connect
App Store
Bundle ID