Comments (1)
Hello @maximedb
I have a feeling that you've already found the answer since you asked this question last December, nevertheless I would like to answer it.
In the basic implementation of attention mechanism you have three separate weight matrices for query, key and value and thus in order to obtain q, k, v you apply these 3 matrices separately on input x (in self-attention). Here is an example.
This approach is covered with Linear class.
The other approach is to have a single matrix that stores weights for all three matrices (query, key and value). So you can apply this big combined matrix ones (helps with parallelization on GPU) and then you can split the output into three chunks to have queries, keys and values. Here is an example.
For this approach MergedLinear class is created.
from lora.
Related Issues (20)
- Code samples for "UNDERSTANDING THE LOW-RANK UPDATES" chapter (chapter 7). HOT 2
- why use alpha/r in stead of alpha? HOT 2
- Error in MergedLinear HOT 5
- RuntimeError: CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)` HOT 4
- Pre-trained conv weight is not same as that self.conv.weight HOT 3
- matmul ordering in MergedLinear HOT 1
- How does this paper search the hyperparameters on GLUE datasets with Roberta? HOT 1
- PyPi version and GitHub version give different results HOT 1
- Embedding reset_parameters() implement wrong HOT 3
- Conv1d and Conv3d are not working HOT 2
- fine tuning RoBERTa-base with LoRA (ValueError: Classification metrics can't handle a mix of binary and multilabel-indicator targets)
- The content on pypi does not seem to be updated HOT 3
- Marvelous! Great work! HOT 1
- Bug after the latest commit #63 HOT 1
- MergedLinear bug? HOT 2
- Is it possible to fine-tuning model to extend token limit length? HOT 1
- Replicating Result on WebNLG HOT 1
- About GPU utilization HOT 1
- there's some bug in layer.py
- AB matrix initialization in layers.py does not conform to the description of the paper HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lora.