Update README.md
Browse files
README.md
CHANGED
|
@@ -13,6 +13,19 @@ tags:
|
|
| 13 |
---
|
| 14 |
# Model Card — logx v0.1.0
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NL → nginx-log-query translation model. Fine-tune of
|
| 17 |
[`google/t5-efficient-tiny`](https://huggingface.co/google/t5-efficient-tiny)
|
| 18 |
(15.57M params, Apache-2.0) that maps English questions about nginx logs to a
|
|
@@ -38,17 +51,6 @@ git clone https://github.com/devang007/logX && cd logX
|
|
| 38 |
logx -q "top 5 ips" -src /var/log/nginx/access.log
|
| 39 |
```
|
| 40 |
|
| 41 |
-
Or directly with 🤗 Transformers:
|
| 42 |
-
|
| 43 |
-
```python
|
| 44 |
-
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 45 |
-
tok = AutoTokenizer.from_pretrained("path/to/unzipped/model")
|
| 46 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("path/to/unzipped/model")
|
| 47 |
-
ids = tok("parse: how many 502s in the last hour", return_tensors="pt").input_ids
|
| 48 |
-
print(tok.decode(model.generate(ids, max_length=128)[0], skip_special_tokens=True))
|
| 49 |
-
# {"action":"count","source":"nginx_access","filters":[{"field":"status","op":"eq","value":"502"}],"time":{"last":"1h"}}
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
The tokenizer is **not** a stock T5 tokenizer: 6 tokens (`< \ ^ { } ~`) were
|
| 53 |
added so JSON braces survive encoding, with a patched Metaspace pre-tokenizer.
|
| 54 |
Always load the tokenizer shipped in the zip, never the base model's.
|
|
|
|
| 13 |
---
|
| 14 |
# Model Card — logx v0.1.0
|
| 15 |
|
| 16 |
+
|
| 17 |
+
Run directly with 🤗 Transformers:
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 21 |
+
tok = AutoTokenizer.from_pretrained("path/to/unzipped/model")
|
| 22 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("path/to/unzipped/model")
|
| 23 |
+
ids = tok("parse: how many 502s in the last hour", return_tensors="pt").input_ids
|
| 24 |
+
print(tok.decode(model.generate(ids, max_length=128)[0], skip_special_tokens=True))
|
| 25 |
+
# {"action":"count","source":"nginx_access","filters":[{"field":"status","op":"eq","value":"502"}],"time":{"last":"1h"}}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
|
| 29 |
NL → nginx-log-query translation model. Fine-tune of
|
| 30 |
[`google/t5-efficient-tiny`](https://huggingface.co/google/t5-efficient-tiny)
|
| 31 |
(15.57M params, Apache-2.0) that maps English questions about nginx logs to a
|
|
|
|
| 51 |
logx -q "top 5 ips" -src /var/log/nginx/access.log
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
The tokenizer is **not** a stock T5 tokenizer: 6 tokens (`< \ ^ { } ~`) were
|
| 55 |
added so JSON braces survive encoding, with a patched Metaspace pre-tokenizer.
|
| 56 |
Always load the tokenizer shipped in the zip, never the base model's.
|