- Notifications
You must be signed in to change notification settings - Fork328
fix for np.float32 serialization#589
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
885cc59
Added truncation and padding to tokenizer
santiatpml6a38984
Added truncation and padding to tokenizer
santiatpml0f692f1
np.float32 serialization fix
santiatpml2521e26
Updated tests with HF pipelines
santiatpmla8d1b9c
Merge branch 'santi-llm-apis' of https://github.com/postgresml/postgr…
santiatpmla9a3805
Removed transforms from tests
santiatpmlde68ce6
Added protobuf to dockerfile local for finbert support
santiatpmle8bc2bd
Removed protobuf
santiatpmlFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
90 changes: 90 additions & 0 deletionspgml-extension/examples/finetune.sql
This file contains hidden or 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,90 @@ | ||
-- Exit on error (psql) | ||
\set ON_ERROR_STOP true | ||
\timing on | ||
SELECT pgml.load_dataset('kde4', kwargs => '{"lang1": "en", "lang2": "es"}'); | ||
CREATE OR REPLACE VIEW kde4_en_to_es AS | ||
SELECT translation->>'en' AS "en", translation->>'es' AS "es" | ||
FROM pgml.kde4 | ||
LIMIT 10; | ||
SELECT pgml.tune( | ||
'Translate English to Spanish', | ||
task => 'translation', | ||
relation_name => 'kde4_en_to_es', | ||
y_column_name => 'es', -- translate into spanish | ||
model_name => 'Helsinki-NLP/opus-mt-en-es', | ||
hyperparams => '{ | ||
"learning_rate": 2e-5, | ||
"per_device_train_batch_size": 16, | ||
"per_device_eval_batch_size": 16, | ||
"num_train_epochs": 1, | ||
"weight_decay": 0.01, | ||
"max_length": 128 | ||
}', | ||
test_size => 0.5, | ||
test_sampling => 'last' | ||
); | ||
SELECT pgml.load_dataset('imdb'); | ||
SELECT pgml.tune( | ||
'IMDB Review Sentiment', | ||
task => 'text-classification', | ||
relation_name => 'pgml.imdb', | ||
y_column_name => 'label', | ||
model_name => 'distilbert-base-uncased', | ||
hyperparams => '{ | ||
"learning_rate": 2e-5, | ||
"per_device_train_batch_size": 16, | ||
"per_device_eval_batch_size": 16, | ||
"num_train_epochs": 1, | ||
"weight_decay": 0.01 | ||
}', | ||
test_size => 0.5, | ||
test_sampling => 'last' | ||
); | ||
SELECT pgml.predict('IMDB Review Sentiment', 'I love SQL'); | ||
SELECT pgml.load_dataset('squad_v2'); | ||
SELECT pgml.tune( | ||
'SQuAD Q&A v2', | ||
'question-answering', | ||
'pgml.squad_v2', | ||
'answers', | ||
'deepset/roberta-base-squad2', | ||
hyperparams => '{ | ||
"evaluation_strategy": "epoch", | ||
"learning_rate": 2e-5, | ||
"per_device_train_batch_size": 16, | ||
"per_device_eval_batch_size": 16, | ||
"num_train_epochs": 1, | ||
"weight_decay": 0.01, | ||
"max_length": 384, | ||
"stride": 128 | ||
}', | ||
test_size => 11873, | ||
test_sampling => 'last' | ||
); | ||
SELECT pgml.load_dataset('billsum', kwargs => '{"split": "ca_test"}'); | ||
CREATE OR REPLACE VIEW billsum_training_data | ||
AS SELECT title || '\n' || text AS text, summary FROM pgml.billsum; | ||
SELECT pgml.tune( | ||
'Legal Summarization', | ||
task => 'summarization', | ||
relation_name => 'billsum_training_data', | ||
y_column_name => 'summary', | ||
model_name => 'sshleifer/distilbart-xsum-12-1', | ||
hyperparams => '{ | ||
"learning_rate": 2e-5, | ||
"per_device_train_batch_size": 2, | ||
"per_device_eval_batch_size": 2, | ||
"num_train_epochs": 1, | ||
"weight_decay": 0.01, | ||
"max_input_length": 1024, | ||
"max_summary_length": 128 | ||
}', | ||
test_size => 0.01, | ||
test_sampling => 'last' | ||
); |
129 changes: 50 additions & 79 deletionspgml-extension/examples/transformers.sql
This file contains hidden or 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
12 changes: 9 additions & 3 deletionspgml-extension/src/bindings/transformers.py
This file contains hidden or 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
1 change: 1 addition & 0 deletionspgml-extension/tests/test.sql
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.