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

Remove unnecessary init in TextUnsupervised #504

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions Datasets/TextUnsupervised/TextUnsupervised.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@ public struct TextUnsupervised {
public let variant: TextUnsupervisedVariant
private let variantDetails: TextUnsupervisedVariantDetails

public init(
variant: TextUnsupervisedVariant = TextUnsupervisedVariant.wikiText2
) {
// Empty BytePairEncoder.
let vocabulary = Vocabulary(tokensToIds: ["<|endoftext|>": 0])
let mergePairs = [BytePairEncoder.Pair: Int]()
let bpe = BytePairEncoder(vocabulary: vocabulary, mergePairs: mergePairs)

self.init(bpe: bpe, variant: variant)
}

public init(
bpe: BytePairEncoder? = nil,
variant: TextUnsupervisedVariant = TextUnsupervisedVariant.wikiText2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final class TextUnsupervisedTests: XCTestCase {
XCTAssertEqual(example.second.shape[0], 1024)
totalCount += 1
}
XCTAssertEqual(totalCount, 128)
XCTAssertEqual(totalCount, 24)
}

func testCreateWikiText2WithBpe() {
Expand Down Expand Up @@ -94,7 +94,7 @@ final class TextUnsupervisedTests: XCTestCase {
XCTAssertEqual(example.second.shape[0], 1024)
totalCount += 1
}
XCTAssertEqual(totalCount, 64)
XCTAssertEqual(totalCount, 12)
}
}

Expand Down