-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change embeddings and predict methods to accept both a single input a…
- Loading branch information
1 parent
38edd3e
commit 0672744
Showing
4 changed files
with
101 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Model module | ||
""" | ||
|
||
import unittest | ||
|
||
from staticvectors import StaticVectors | ||
|
||
|
||
class TestModel(unittest.TestCase): | ||
""" | ||
Model tests. | ||
""" | ||
|
||
def testGenerate(self): | ||
""" | ||
Test generating a vector for an out of vocabulary token | ||
""" | ||
|
||
# Create model for testing | ||
model1, model2 = StaticVectors(), StaticVectors() | ||
|
||
# Set the dimensions for testing | ||
model1.config = {"dim": 100} | ||
model2.config = {"dim": 100} | ||
|
||
# Generate vectors from two different models for same token and test they are the same | ||
self.assertTrue((model1.generate("abc") == model2.generate("abc")).all()) | ||
|
||
# Repeat and confirm it's still the same | ||
self.assertTrue((model1.generate("abc") == model2.generate("abc")).all()) |