fxmarty / accelerated-pytorch-transformers-generation Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
We suspect the concatenations of the key/value buffer at each generation step to be expensive.
FasterTransformer does preallocate the kv cache. Preallocating may also help torch.compile
, also I don't quite get why (there are still dynamic shapes in the model itself, so why care about the model I/O?).
Some optimizations may still be missing. On commit 1acc7e4ea234d7143700234e51877acc9859f9ed
past_key_values
buffer should be initialized in the background, instead of requiring the user to initialize it himself and requiring to pass generate(**inputs, past_key_values=past_key_values)
.accelerate
with naive pipeline parallelism, as the buffer is currently initialized on a single devicemax_new_tokens
. This may help reducing memory usage (and speed? probably not).greedy_search
torch.compile
(find torchdynamo graph breaks and remove them if possible?)attention_mask
token_type_ids
(llama does not use it though)qkv_proj
help instead of the current q_proj
separate from kv_proj
? [yes, helps slightly]__getattr__
overheadA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.