Konstantinos commited on
Commit
6ace3ba
·
verified ·
1 Parent(s): 4595159

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +84 -0
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - el
4
+ library_name: transformers
5
+ pipeline_tag: text-generation
6
+ license: cc-by-nc-4.0
7
+ tags:
8
+ - greek
9
+ - text-generation
10
+ - instruction-tuned
11
+ - llama
12
+ ---
13
+
14
+ # LexisLM-500m-Instruct
15
+
16
+ LexisLM-500m-Instruct is a Greek-focused instruction model fine-tuned from the 502-million-parameter LexisLM-500M base checkpoint. It is a decoder-only model exported in BF16 and compatible with the Transformers Llama architecture.
17
+
18
+ ## Model details
19
+
20
+ | Property | Value |
21
+ |---|---|
22
+ | Layers | 16 |
23
+ | Hidden size | 1,536 |
24
+ | Attention heads | 16 |
25
+ | Context length | 4,096 tokens |
26
+ | Vocabulary | 32,004 tokens |
27
+ | Tokenizer | Greek byte-level BPE with chat tokens |
28
+ | Fine-tuning checkpoint | `runs/greek_500m_22bn_ctx4k_sft_mixed/best.pt`, step 3,802 |
29
+ | Fine-tuning data | Greek EuroAlpaca, Aya Greek SFT, and Greek chat SFT mixtures |
30
+
31
+ The chat template prepends `<eos>`, formats each message as `<|role|>` followed by a newline and content, and ends each turn with `<|endofturn|>`. Generation stops at `<eos>` or `<|endofturn|>`.
32
+
33
+ ## Usage
34
+
35
+ ```python
36
+ import torch
37
+ from transformers import AutoModelForCausalLM, AutoTokenizer
38
+
39
+ model_id = "ComputationalLinguisticsPlatform/LexisLM-500m-Instruct"
40
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
41
+ torch.set_num_threads(4)
42
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
43
+ torch.manual_seed(42)
44
+ messages = [{"role": "user", "content": "Η πρωτεύουσα της Ελλάδας είναι"}]
45
+ inputs = tokenizer.apply_chat_template(
46
+ messages, add_generation_prompt=True, tokenize=True,
47
+ return_tensors="pt", return_dict=True,
48
+ )
49
+ inputs = {key: value.to(model.device) for key, value in inputs.items()
50
+ if key in ("input_ids", "attention_mask")}
51
+ output = model.generate(
52
+ **inputs, max_new_tokens=64, do_sample=True, temperature=0.1, top_p=0.9,
53
+ eos_token_id=[tokenizer.eos_token_id,
54
+ tokenizer.convert_tokens_to_ids("<|endofturn|>")],
55
+ pad_token_id=tokenizer.pad_token_id,
56
+ )
57
+ print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
58
+ ```
59
+
60
+ Output from this example (CPU FP32, seed 42):
61
+
62
+ ```text
63
+ Η πρωτεύουσα της Ελλάδας είναι η Αθήνα.
64
+ ```
65
+
66
+ ## Evaluation
67
+
68
+ The selected SFT checkpoint was evaluated with this project's Greek answer-likelihood protocol. ARC used 25 demonstrations, MMLU used 5, and TruthfulQA used 0. These scores are specific to that protocol and are not instruction-following evaluations.
69
+
70
+ | Benchmark | Metric | Score |
71
+ |---|---|---:|
72
+ | ARC-Easy | Character-normalized accuracy | 41.58% |
73
+ | ARC-Challenge | Character-normalized accuracy | 25.26% |
74
+ | MMLU | Accuracy | 26.04% |
75
+ | TruthfulQA | MC1 accuracy | 23.13% |
76
+ | TruthfulQA | MC2 score | 41.35% |
77
+
78
+ ## Limitations
79
+
80
+ The model may produce incorrect, biased, or unsafe text. Greek is the primary target language. The benchmarks above do not establish reliability for a specific application.
81
+
82
+ ## Provenance and license
83
+
84
+ Pretraining used Greek Wikipedia and [FineWeb2](https://huggingface.co/datasets/HuggingFaceFW/fineweb-2), which is released under ODC-By 1.0. Supervised fine-tuning used the three data mixtures listed above, including [EuroAlpaca](https://huggingface.co/datasets/Telefonica/EuroAlpaca). EuroAlpaca is licensed under CC BY-NC 4.0, so this instruction-tuned model is released for noncommercial use under CC BY-NC 4.0. The export was produced with `scripts/export_hf.py` from the selected training checkpoint.