Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
|
6 |
+
## How to use
|
7 |
+
|
8 |
+
Requirements:
|
9 |
+
|
10 |
+
```bash
|
11 |
+
git clone https://github.com/ddevaul/transformers
|
12 |
+
```
|
13 |
+
|
14 |
+
```bash
|
15 |
+
cd transformers
|
16 |
+
```
|
17 |
+
|
18 |
+
```bash
|
19 |
+
pip install -r requirements.txt
|
20 |
+
```
|
21 |
+
|
22 |
+
```bash
|
23 |
+
cd ..
|
24 |
+
```
|
25 |
+
|
26 |
+
Now open your file and add this:
|
27 |
+
|
28 |
+
```python
|
29 |
+
import sys
|
30 |
+
import torch
|
31 |
+
sys.path.append('./transformers/src')
|
32 |
+
from torch.utils.checkpoint import checkpoint
|
33 |
+
from transformers2 import BertConfig, BertTokenizer
|
34 |
+
from transformers2.models.bert import BertForMaskedLM
|
35 |
+
|
36 |
+
preload_path = 'cabrooks/character-level-logion'
|
37 |
+
char_tokenizer = BertTokenizer.from_pretrained(preload_path)
|
38 |
+
wordpiece_tokenizer = BertTokenizer.from_pretrained("cabrooks/LOGION-50k_wordpiece")
|
39 |
+
config = BertConfig()
|
40 |
+
config.word_piece_vocab_size = 50000
|
41 |
+
config.vocab_size = char_tokenizer.vocab_size
|
42 |
+
config.char_tokenizer = char_tokenizer
|
43 |
+
config.wordpiece_tokenizer = wordpiece_tokenizer
|
44 |
+
config.max_position_embeddings = 1024
|
45 |
+
config.device2 = device
|
46 |
+
model = BertForMaskedLM(config).to(device)
|
47 |
+
```
|
48 |
+
|
49 |
+
|
50 |
+
## Cite
|
51 |
+
|
52 |
+
If you use this model in your research, please cite the paper:
|
53 |
+
|
54 |
+
```
|
55 |
+
@misc{logion-base,
|
56 |
+
title={Logion: Machine Learning for Greek Philology},
|
57 |
+
author={Cowen-Breen, C. and Brooks, C. and Haubold, J. and Graziosi, B.},
|
58 |
+
year={2023},
|
59 |
+
eprint={2305.01099},
|
60 |
+
archivePrefix={arXiv},
|
61 |
+
primaryClass={cs.CL}
|
62 |
+
}
|
63 |
+
```
|