Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Curio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jim Wallace
Curio
Commits
fd1d3c06
Commit
fd1d3c06
authored
1 year ago
by
Abhinav Jain
Browse files
Options
Downloads
Patches
Plain Diff
attempting to add swiftannoy back
parent
9515e6d1
No related branches found
No related tags found
1 merge request
!15
Add interface for using generic CoreML LLMs
Pipeline
#116067
passed with warnings
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Package.swift
+1
-1
1 addition, 1 deletion
Package.swift
Tests/SwiftNLPTests/AllMiniLM_sampleTest.swift
+22
-21
22 additions, 21 deletions
Tests/SwiftNLPTests/AllMiniLM_sampleTest.swift
with
23 additions
and
22 deletions
Package.swift
+
1
−
1
View file @
fd1d3c06
...
@@ -32,7 +32,7 @@ let package = Package(
...
@@ -32,7 +32,7 @@ let package = Package(
.
target
(
.
target
(
name
:
"SwiftNLP"
,
name
:
"SwiftNLP"
,
dependencies
:
[
dependencies
:
[
//
"SwiftAnnoy",
"SwiftAnnoy"
,
"SwiftNLPGenericLLMMacros"
,
"SwiftNLPGenericLLMMacros"
,
.
product
(
name
:
"HNSWAlgorithm"
,
package
:
"similarity-topology"
),
.
product
(
name
:
"HNSWAlgorithm"
,
package
:
"similarity-topology"
),
.
product
(
name
:
"HNSWEphemeral"
,
package
:
"similarity-topology"
),
.
product
(
name
:
"HNSWEphemeral"
,
package
:
"similarity-topology"
),
...
...
This diff is collapsed.
Click to expand it.
Tests/SwiftNLPTests/AllMiniLM_sampleTest.swift
+
22
−
21
View file @
fd1d3c06
...
@@ -4,7 +4,7 @@ import XCTest
...
@@ -4,7 +4,7 @@ import XCTest
import
Darwin
import
Darwin
@testable
import
SwiftNLP
@testable
import
SwiftNLP
//
@testable import SwiftAnnoy
@testable
import
SwiftAnnoy
final
class
BERT_test
:
XCTestCase
{
final
class
BERT_test
:
XCTestCase
{
...
@@ -48,27 +48,28 @@ final class BERT_test: XCTestCase {
...
@@ -48,27 +48,28 @@ final class BERT_test: XCTestCase {
fatalError
(
"Error occurred!"
)
fatalError
(
"Error occurred!"
)
}
}
}
}
let
index
=
AnnoyIndex
<
Float
>
(
itemLength
:
384
,
metric
:
.
euclidean
)
try
?
index
.
addItems
(
items
:
&
database_embedding
)
try
?
index
.
build
(
numTrees
:
50
)
let
results
=
index
.
getNNsForVector
(
vector
:
&
query_embedding
,
neighbors
:
8
)
if
let
finalresult
=
results
{
let
extractedIndeices
=
finalresult
.
indices
for
index
in
extractedIndeices
{
if
index
<
docs
.
count
{
print
(
docs
[
index
])
}
else
{
print
(
"Index
\(
index
)
out of range."
)
}
}
}
print
(
results
)
print
(
database_embedding
)
}
}
// // let index = AnnoyIndex<Float>(itemLength: embedding_dim, metric: .euclidean)
// // try? index.addItems(items: &database_embedding)
// // try? index.build(numTrees: 50)
// // let results = index.getNNsForVector(vector: &query_embedding, neighbors: 8)
// // // if let finalresult = results {
// // // let extractedIndeices = finalresult.indices
// // // for index in extractedIndeices {
// // // if index < docs.count {
// // // print(docs[index])
// // // } else {
// // // print("Index \(index) out of range.")
// // // }
// // // }
// // // }
// // print(results)
// print(database_embedding)
}
}
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment