Skip to content

Huggingface improvements: truncation, cuda, concat - #64

Merged
mschrimpf merged 10 commits into
mainfrom
mschrimpf/huggingface-improvements
Sep 8, 2022
Merged

mschrimpf merged 10 commits into
mainfrom
mschrimpf/huggingface-improvements

Conversation

@mschrimpf

Copy link
Copy Markdown
Member
  • truncate long inputs so that we no longer pass more tokens to the model than it can handle
  • move model and tensors to gpu when cuda available
  • concatenate outputs rather than merging them for a significant speed improvement (we do not need to infer the merge dimension because we can just concat along presentation)

@mschrimpf
mschrimpf force-pushed the mschrimpf/huggingface-improvements branch from fbe228b to 8073910 Compare September 6, 2022 16:44
@mschrimpf
mschrimpf merged commit 189eed0 into main Sep 8, 2022
@mschrimpf
mschrimpf deleted the mschrimpf/huggingface-improvements branch September 8, 2022 16:48
mschrimpf added a commit that referenced this pull request Oct 26, 2022
* add test for long inputs; truncate accordingly in tokenizer

also move next-word prediction tests first

* implement cuda support in huggingface wrapper

* remove tqdm addition

* fix truncation from left

* concat outputs along `presentation` instead of merge

concat is much faster because we do not need to infer shapes first

* extract tokenization method, keep track of overflow

* fix approx test

* get rid of `numel` assertion to avoid confusion
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.

2 participants