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

Variable batchsize decrease factor #2

Open
ChielWH opened this issue Jun 10, 2021 · 0 comments
Open

Variable batchsize decrease factor #2

ChielWH opened this issue Jun 10, 2021 · 0 comments

Comments

@ChielWH
Copy link

ChielWH commented Jun 10, 2021

First of all, many thanks for this handy utility package! My use-case is to detect the largest batchsize possible for translation during inference, which is rather low. I see that the batchsize decrease factor is fixed at 2:

@dataclassclass Batchsize:    
    ...
    def decrease_batchsize(self):        
        self.value //= 2        
        assert self.value

For my use-case, this quite an aggressive decrease factor. Might it be possible to make this variable? So that it can be used in such a way:

@toma.batch(initial_batchsize=32, cache_type=GlobalBatchsizeCache, decrease_factor=1.2)
def infer(batchsize, *args, **kwargs):
    ...

I'm happy to help, so if you would like me to make a PR, please let me know.

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

No branches or pull requests

1 participant