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

script to continuously evaluate elser #2670

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidkyle
Copy link
Member

First download the elser model locally. Either

The script runs pytorch_inference, loads the model then continuously runs inference on it. Logging is to std out, the model output is written to a json file. Every 100 request the script asks the pytorch_inference how much memory it is using and this is written to the same json file. grep mem out.json will show that data.

Run with

python3 signal9.py '/PATH/TO/elser_2/elser_model_2.pt' --num_allocations=4

--num_threads_per_allocation and --num_allocations are the parameters to tweak. Increasing either of those will make inference faster and changes in memory should be seen sooner.

parser.add_argument('--output_file', default='out.json')
parser.add_argument('--log_file', default='log.txt')
parser.add_argument('--num_threads_per_allocation', type=int, help='The number of inference threads used by LibTorch. Defaults to 1.')
parser.add_argument('--num_allocations', type=int, help='The number of allocations for parallel forwarding. Defaults to 1')

Choose a reason for hiding this comment

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

We should probably include setting the cache size here. Does it default to 0 if --cacheMemorylimitBytes isn't passed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it default to 0 if --cacheMemorylimitBytes isn't passed?

Yes, the default cache value is 0:

  --cacheMemorylimitBytes arg           Optional memory in bytes that the 
                                        inference cache can use - default is 0 
                                        which disables caching

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.

3 participants