Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-nc-sa-4.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-sa-4.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
```python
|
| 6 |
+
from transformers import AutoModelForCausalLM, AutoModel
|
| 7 |
+
import os
|
| 8 |
+
import torch
|
| 9 |
+
token = os.environ["token_id"]
|
| 10 |
+
splade = AutoModelForCausalLM.from_pretrained("naver/splade-code-06B", token=token, trust_remote_code=True)
|
| 11 |
+
device = (torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu"))
|
| 12 |
+
splade.to(device)
|
| 13 |
+
splade.eval()
|
| 14 |
+
queries = ["SELECT *\nFROM Student\nWHERE Age = (\nSELECT MAX(Age)\nFROM Student\nWHERE Group = 'specific_group'\n)\nAND Group = 'specific_group';"]
|
| 15 |
+
bow_dict = splade.encode(queries, prompt_type="query", top_k_q=10, return_dict=True, print_dict=True)
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
```
|
| 19 |
+
+--------------------------------------------------------------------+
|
| 20 |
+
| TOP ACTIVATED WORDS |
|
| 21 |
+
+--------------------------------------------------------------------+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
* INPUT: SELECT *
|
| 25 |
+
FROM Student
|
| 26 |
+
WHERE Age = (
|
| 27 |
+
SELECT MAX(Age)
|
| 28 |
+
FROM Student
|
| 29 |
+
WHERE Group = 'specific_group'
|
| 30 |
+
)
|
| 31 |
+
AND Group = 'specific_group';
|
| 32 |
+
|
| 33 |
+
Δ group | ββββββββββββββββββββ 2.34
|
| 34 |
+
Δ Age | ββββββββββββββββββββ 2.34
|
| 35 |
+
Δ age | βββββββββββββββββββ 2.33
|
| 36 |
+
Δ specific | βββββββββββββββββββ 2.30
|
| 37 |
+
_group | βββββββββββββββββββ 2.30
|
| 38 |
+
Δ Student | βββββββββββββββββββ 2.30
|
| 39 |
+
Δ max | ββββββββββββββββββ 2.22
|
| 40 |
+
Δ Max | ββββββββββββββββββ 2.22
|
| 41 |
+
Δ student | ββββββββββββββββββ 2.20
|
| 42 |
+
Δ Group | ββββββββββββββββββ 2.20
|
| 43 |
+
```
|