-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #221 Added an integration test for a model upload and prediction (should fail) [CodeBuild] * #221 Moved the version number (the test should fail) [CodeBuild] * #221 Fixed the directory structure the uploader creates [CodeBuild] * #221 Fixed the directory structure the uploader creates [CodeBuild] * #221 Fixed the integration tests [CodeBuild] * #221 Updated the unit test test_model_downloader [CodeBuild]
- Loading branch information
Showing
9 changed files
with
597 additions
and
580 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Transformers Extension 1.0.1, 2024-04-25 | ||
|
||
Code name: Fixed the directory structure bug | ||
|
||
|
||
## Summary | ||
|
||
Fixed the directory structure made by the model upload UDF. | ||
|
||
### Bugs | ||
|
||
- #221: Directory Structure that Model Upload UDF creates is different from what PredictionUDFs expect. | ||
|
||
### Features | ||
|
||
N/A | ||
|
||
### Refactorings | ||
|
||
N/A | ||
|
||
### Security | ||
|
||
N/A |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
63 changes: 63 additions & 0 deletions
63
tests/integration_tests/with_db/udfs/test_prediction_with_downloader_udf.py
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,63 @@ | ||
import time | ||
from tests.utils import postprocessing | ||
|
||
SUB_DIR = 'test_downloader_with_prediction_sub_dir' | ||
MODEL_NAME = 'gaunernst/bert-tiny-uncased' | ||
|
||
|
||
def test_prediction_with_downloader_udf( | ||
setup_database, pyexasol_connection, bucketfs_location): | ||
bucketfs_conn_name, schema_name = setup_database | ||
|
||
try: | ||
# execute downloader UDF | ||
input_data = ( | ||
MODEL_NAME, | ||
SUB_DIR, | ||
bucketfs_conn_name, | ||
'' | ||
) | ||
query = f""" | ||
SELECT TE_MODEL_DOWNLOADER_UDF( | ||
t.model_name, | ||
t.sub_dir, | ||
t.bucketfs_conn_name, | ||
t.token_conn_name | ||
) FROM (VALUES {str(input_data)} AS | ||
t(model_name, sub_dir, bucketfs_conn_name, token_conn_name)); | ||
""" | ||
|
||
pyexasol_connection.execute(query).fetchall() | ||
time.sleep(10) | ||
|
||
# execute the filling mask UDF | ||
text_data = "I <mask> you so much." | ||
top_k = 3 | ||
input_data = ( | ||
'', | ||
bucketfs_conn_name, | ||
SUB_DIR, | ||
MODEL_NAME, | ||
text_data, | ||
top_k | ||
) | ||
|
||
query = f"SELECT TE_FILLING_MASK_UDF(" \ | ||
f"t.device_id, " \ | ||
f"t.bucketfs_conn_name, " \ | ||
f"t.sub_dir, " \ | ||
f"t.model_name, " \ | ||
f"t.text_data," \ | ||
f"t.top_k" \ | ||
f") FROM (VALUES {str(input_data)} " \ | ||
f"AS t(device_id, bucketfs_conn_name, sub_dir, " \ | ||
f"model_name, text_data, top_k));" | ||
|
||
result = pyexasol_connection.execute(query).fetchall() | ||
|
||
# assertions | ||
assert len(result) == top_k | ||
assert all(row[-1] is None for row in result) | ||
|
||
finally: | ||
postprocessing.cleanup_buckets(bucketfs_location, SUB_DIR) |
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