Skip to content

Commit

Permalink
add profiling test cases and script
Browse files Browse the repository at this point in the history
  • Loading branch information
makcedward committed Nov 23, 2021
1 parent f1a8437 commit 703b318
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/profiling/word/profile_context_word_embs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import datetime

def run_core():
print(datetime.datetime.now(), 'before import')
import nlpaug.augmenter.word as naw

print(datetime.datetime.now(), 'before init')
aug = naw.ContextualWordEmbsAug(model_path='bert-base-uncased', model_type="bert", use_custom_api=True)
text = 'The quick brown fox jumps over the lazy dog.'
print(datetime.datetime.now(), 'before augment')
aug.augment([text] * 2)
print(datetime.datetime.now(), 'done')

if __name__ == '__main__':
run_core()

1 change: 1 addition & 0 deletions test/run_profile_context_word_embs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
py-spy record -o profile.svg -- python ./test/profiling/word/profile_context_word_embs.py
1 change: 1 addition & 0 deletions test/run_profile_import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python -X importtime -c 'import nlpaug' 2> nlpaug-imports.log

0 comments on commit 703b318

Please sign in to comment.