Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for <macOS 15 build systems #283

Merged
merged 21 commits into from
Dec 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4915574
Prevent units tests from succeeding on error
ZachNagengast Dec 20, 2024
2eff5b0
Use compiler flags for mltensor sampling
ZachNagengast Dec 20, 2024
936e4ed
Add flag for mltensor utils
ZachNagengast Dec 20, 2024
c39f052
Update platform versions for development and pre-release tests workflows
ZachNagengast Dec 20, 2024
f1f5dbe
Differentiate artifact name in unit-tests.yml workflow
ZachNagengast Dec 20, 2024
b43015f
Stop unit tests early if run condition is false
ZachNagengast Dec 20, 2024
13cf628
Fix macos 14 runner ios version
ZachNagengast Dec 20, 2024
9020e30
Use success error code for expected test skipping
ZachNagengast Dec 20, 2024
ac83405
Lower priority of early stopping task, cleanup
ZachNagengast Dec 20, 2024
2a8b95b
Formatting
ZachNagengast Dec 20, 2024
5a5517d
Fix tests, attempt to lower early stopping task priority further
ZachNagengast Dec 20, 2024
87d1720
Fix inverted action run condition logic
ZachNagengast Dec 20, 2024
cf0b880
Use detached lower priority for early stopping to resolve priority in…
ZachNagengast Dec 20, 2024
f052eac
Fix tests
ZachNagengast Dec 20, 2024
cb589e4
Set test priority for early stopping, fix correctness test on macos 14
ZachNagengast Dec 20, 2024
59ef54f
Upgrade unit test task priority
ZachNagengast Dec 20, 2024
f2d3c22
Specify device for older iOS simulators
ZachNagengast Dec 20, 2024
024049c
Fix workflow for ios-device
ZachNagengast Dec 20, 2024
1d3b1f4
Disable ealy stopping test on watchos
ZachNagengast Dec 20, 2024
250ed9d
Set xcode version on CI
ZachNagengast Dec 20, 2024
75bf130
Make sure test simulator is available on runner
ZachNagengast Dec 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formatting
ZachNagengast committed Dec 20, 2024

Verified

This commit was signed with the committer’s verified signature.
so1ve Ray
commit 2a8b95bfafa9f4b8b9898978a98c57d7514e2e25
23 changes: 11 additions & 12 deletions Tests/WhisperKitTests/UnitTests.swift
Original file line number Diff line number Diff line change
@@ -456,7 +456,7 @@ final class UnitTests: XCTestCase {
let kvCacheUpdateMask = try! MLMultiArray(shape: [1, 224], dataType: .float16)
let encoderOutputEmbeds = try! MLMultiArray(shape: [1, 384, 1, 1500], dataType: .float16)
let decoderKeyPaddingMask = try! MLMultiArray(shape: [1, 224], dataType: .float16)

let input = TextDecoderMLMultiArrayInputType(
inputIds: inputIds,
cacheLength: cacheLength,
@@ -466,7 +466,7 @@ final class UnitTests: XCTestCase {
encoderOutputEmbeds: encoderOutputEmbeds,
decoderKeyPaddingMask: decoderKeyPaddingMask
)

XCTAssertNotNil(input as TextDecoderInputType)
XCTAssertEqual(input.inputIds.shape, [1])
XCTAssertEqual(input.cacheLength.shape, [1])
@@ -476,17 +476,17 @@ final class UnitTests: XCTestCase {
XCTAssertEqual(input.encoderOutputEmbeds.shape, [1, 384, 1, 1500])
XCTAssertEqual(input.decoderKeyPaddingMask.shape, [1, 224])
}

func testTextDecoderMLMultiArrayOutputType() {
let logits = try! MLMultiArray(shape: [1, 51865, 1, 1], dataType: .float16)
let cache = DecodingCache(
keyCache: try! MLMultiArray(shape: [1, 1536, 1, 224], dataType: .float16),
valueCache: try! MLMultiArray(shape: [1, 1536, 1, 224], dataType: .float16),
alignmentWeights: try! MLMultiArray(shape: [1, 224], dataType: .float16)
)

let output = TextDecoderMLMultiArrayOutputType(logits: logits, cache: cache)

XCTAssertNotNil(output as TextDecoderOutputType)
XCTAssertEqual(output.logits?.shape, [1, 51865, 1, 1])
XCTAssertNotNil(output.cache)
@@ -502,12 +502,12 @@ final class UnitTests: XCTestCase {
XCTAssertNil(output.logits)
XCTAssertNil(output.cache)
}

func testDecodingCacheInitialization() {
let keyCache = try! MLMultiArray(shape: [1, 1536, 1, 224], dataType: .float16)
let valueCache = try! MLMultiArray(shape: [1, 1536, 1, 224], dataType: .float16)
let alignmentWeights = try! MLMultiArray(shape: [1, 224], dataType: .float16)

let cache = DecodingCache(
keyCache: keyCache,
valueCache: valueCache,
@@ -526,12 +526,12 @@ final class UnitTests: XCTestCase {
XCTAssertNil(cache.valueCache)
XCTAssertNil(cache.alignmentWeights)
}

func testDecodingCacheWithPartialValues() {
let keyCache = try! MLMultiArray(shape: [1, 1536, 1, 224], dataType: .float16)

let cache = DecodingCache(keyCache: keyCache)

XCTAssertNotNil(cache.keyCache)
XCTAssertNil(cache.valueCache)
XCTAssertNil(cache.alignmentWeights)
@@ -1449,7 +1449,6 @@ final class UnitTests: XCTestCase {
isModelMultilingual: false
)


// noTimestampToken should always be suppressed if tokens pass sampleBegin
let logits1 = try MLMultiArray.logits([1.1, 5.2, 0.3, 0.4, 0.2, 0.1, 0.2, 0.1, 0.1])
let result1 = tokensFilter.filterLogits(logits1, withTokens: [4])
@@ -1618,7 +1617,7 @@ final class UnitTests: XCTestCase {
func testVADAudioChunker() async throws {
let chunker = VADAudioChunker()
// Setting windowSamples to default value as WhisperKit.windowSamples is not accessible in this scope
let windowSamples: Int = 480_000
let windowSamples = 480_000

let singleChunkPath = try XCTUnwrap(
Bundle.current.path(forResource: "jfk", ofType: "wav"),