Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of text-embeddings execution and failure handling. #522

Merged
merged 17 commits into from Jan 6, 2022

Conversation

kartik2112
Copy link
Contributor

This PR deals with issue #519

I updated the code so that the SentenceTransformer now generates the embeddings in batches instead of processing it line by line. The progress bar is still there. At the same time, if the default device is not available, the embedding task is re-attempted on the next GPU device.

Challenges that could be raised:

  • If a machine has just 1 GPU? The function torch.cuda.getDeviceCount() will return 1, so it won't re-attempt the execution.
  • If machine does not have a GPU? By default, no device is specified. If the execution fails, the condition to re-attempt does not get satisfied and the failure is reported without a re-attempt

@kartik2112
Copy link
Contributor Author

Added working test case for text embedding

Copy link
Member

@saggu saggu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments @kartik2112

Also, I created a PR from usc-isi-i2 to your fork - kartik2112#1

Always pull the latest changes from the main repo to your fork before creating a PR

kgtk/cli/text_embedding.py Outdated Show resolved Hide resolved
kgtk/gt/embedding_utils.py Show resolved Hide resolved
kgtk/gt/embedding_utils.py Outdated Show resolved Hide resolved
kgtk/gt/embedding_utils.py Outdated Show resolved Hide resolved
pull latest changes in `dev` from usc-isi-i2
@saggu
Copy link
Member

saggu commented Jan 4, 2022

@kartik2112 any updates?

Copy link
Member

@saggu saggu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kartik2112 changes required for handling writing to output file

LICENSE Outdated Show resolved Hide resolved
kgtk/gt/embedding_utils.py Outdated Show resolved Hide resolved
@saggu saggu merged commit 67f5c15 into usc-isi-i2:dev Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants