Update README.md
Browse files
README.md
CHANGED
@@ -7,22 +7,36 @@ tags: []
|
|
7 |
|
8 |
All credit for the original work goes to Tymor Hamamsy and the following authors of this paper https://www.biorxiv.org/content/10.1101/2023.11.26.568742v1
|
9 |
|
10 |
-
We have added a Huggingface compatible wrapper for the model in
|
11 |
|
|
|
12 |
```
|
13 |
-
git clone https://github.com/lhallee/
|
|
|
14 |
```
|
15 |
|
16 |
To use from hugggingface
|
17 |
-
|
18 |
```
|
19 |
from transformers import T5Tokenizer
|
20 |
-
from
|
21 |
|
22 |
tokenizer = T5Tokenizer.from_pretrained('lhallee/ProteinVec')
|
23 |
model = ProteinVec.from_pretrained('lhallee/ProteinVec', config=ProteinVecConfig())
|
24 |
```
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
## The license for the protein vec code
|
27 |
|
28 |
### BSD 3-Clause License
|
@@ -54,4 +68,3 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
54 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
55 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
56 |
|
57 |
-
|
|
|
7 |
|
8 |
All credit for the original work goes to Tymor Hamamsy and the following authors of this paper https://www.biorxiv.org/content/10.1101/2023.11.26.568742v1
|
9 |
|
10 |
+
We have added a Huggingface compatible wrapper for the model in protvec.py
|
11 |
|
12 |
+
Clone and install
|
13 |
```
|
14 |
+
git clone https://github.com/lhallee/ProteinVecHuggingface.git
|
15 |
+
pip install torch pytorch_lightning transformers
|
16 |
```
|
17 |
|
18 |
To use from hugggingface
|
|
|
19 |
```
|
20 |
from transformers import T5Tokenizer
|
21 |
+
from protvec import ProteinVec, ProteinVecConfig
|
22 |
|
23 |
tokenizer = T5Tokenizer.from_pretrained('lhallee/ProteinVec')
|
24 |
model = ProteinVec.from_pretrained('lhallee/ProteinVec', config=ProteinVecConfig())
|
25 |
```
|
26 |
|
27 |
+
Embed a single sequence with ```embed```
|
28 |
+
```
|
29 |
+
model.to_eval()
|
30 |
+
model = model.cuda() # remove if cpu inference
|
31 |
+
embedding = model.embed('SEQWENCE').detach().cpu() # torch.tensor(1, 512)
|
32 |
+
```
|
33 |
+
|
34 |
+
To half precision weights
|
35 |
+
```
|
36 |
+
model.to_half()
|
37 |
+
```
|
38 |
+
|
39 |
+
|
40 |
## The license for the protein vec code
|
41 |
|
42 |
### BSD 3-Clause License
|
|
|
68 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
69 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
70 |
|
|