Text Generation
Transformers
Safetensors
Greek
llama
greek
instruction-tuned
conversational
text-generation-inference
Instructions to use ComputationalLinguisticsPlatform/LexisLM-1B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ComputationalLinguisticsPlatform/LexisLM-1B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ComputationalLinguisticsPlatform/LexisLM-1B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ComputationalLinguisticsPlatform/LexisLM-1B-Instruct") model = AutoModelForCausalLM.from_pretrained("ComputationalLinguisticsPlatform/LexisLM-1B-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ComputationalLinguisticsPlatform/LexisLM-1B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ComputationalLinguisticsPlatform/LexisLM-1B-Instruct
- SGLang
How to use ComputationalLinguisticsPlatform/LexisLM-1B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ComputationalLinguisticsPlatform/LexisLM-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ComputationalLinguisticsPlatform/LexisLM-1B-Instruct with Docker Model Runner:
docker model run hf.co/ComputationalLinguisticsPlatform/LexisLM-1B-Instruct
Upload folder using huggingface_hub
Browse files- README.md +66 -1
- config.json +32 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- special_tokens_map.json +12 -0
- tokenizer.json +0 -0
- tokenizer_config.json +18 -0
README.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- el
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- greek
|
| 8 |
+
- text-generation
|
| 9 |
+
- instruction-tuned
|
| 10 |
+
- llama
|
| 11 |
+
base_model: Konstantinos/LexisLM-1B
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
# LexisLM-1B-Instruct
|
| 15 |
+
|
| 16 |
+
LexisLM-1B-Instruct is a Greek-focused instruction model fine-tuned from LexisLM-1B. It is a 1.093-billion-parameter decoder-only model exported in BF16 and compatible with the Transformers Llama architecture.
|
| 17 |
+
|
| 18 |
+
## Model details
|
| 19 |
+
|
| 20 |
+
| Property | Value |
|
| 21 |
+
|---|---|
|
| 22 |
+
| Layers | 20 |
|
| 23 |
+
| Hidden size | 2,048 |
|
| 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_1b_22bn_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 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 37 |
+
|
| 38 |
+
model_id = "ComputationalLinguisticsLab/LexisLM-1B-Instruct"
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 40 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto")
|
| 41 |
+
messages = [{"role": "user", "content": "Ποια είναι η πρωτεύουσα της Ελλάδας;"}]
|
| 42 |
+
inputs = tokenizer.apply_chat_template(
|
| 43 |
+
messages, add_generation_prompt=True, tokenize=True,
|
| 44 |
+
return_tensors="pt", return_dict=True,
|
| 45 |
+
).to(model.device)
|
| 46 |
+
output = model.generate(**inputs, max_new_tokens=128)
|
| 47 |
+
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Evaluation
|
| 51 |
+
|
| 52 |
+
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.
|
| 53 |
+
|
| 54 |
+
| Benchmark | Metric | Score |
|
| 55 |
+
|---|---|---:|
|
| 56 |
+
| ARC-Easy | Character-normalized accuracy | 44.15% |
|
| 57 |
+
| ARC-Challenge | Character-normalized accuracy | 27.91% |
|
| 58 |
+
| MMLU | Accuracy | 24.67% |
|
| 59 |
+
| TruthfulQA | MC1 accuracy | 22.52% |
|
| 60 |
+
| TruthfulQA | MC2 score | 40.90% |
|
| 61 |
+
|
| 62 |
+
## Limitations
|
| 63 |
+
|
| 64 |
+
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.
|
| 65 |
+
|
| 66 |
+
## Provenance
|
| 67 |
+
|
| 68 |
+
Pretraining used Greek Wikipedia and FineWeb-2. Supervised fine-tuning used the three data mixtures listed above. The export was produced with `scripts/export_hf.py` from the selected training checkpoint. No license is asserted for this model card.
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "llama",
|
| 6 |
+
"vocab_size": 32004,
|
| 7 |
+
"hidden_size": 2048,
|
| 8 |
+
"intermediate_size": 5632,
|
| 9 |
+
"num_hidden_layers": 20,
|
| 10 |
+
"num_attention_heads": 16,
|
| 11 |
+
"num_key_value_heads": 16,
|
| 12 |
+
"head_dim": 128,
|
| 13 |
+
"hidden_act": "silu",
|
| 14 |
+
"max_position_embeddings": 4096,
|
| 15 |
+
"rms_norm_eps": 1e-05,
|
| 16 |
+
"rope_theta": 10000.0,
|
| 17 |
+
"rope_parameters": {
|
| 18 |
+
"rope_type": "default",
|
| 19 |
+
"rope_theta": 10000.0
|
| 20 |
+
},
|
| 21 |
+
"attention_bias": false,
|
| 22 |
+
"attention_dropout": 0.0,
|
| 23 |
+
"mlp_bias": false,
|
| 24 |
+
"tie_word_embeddings": true,
|
| 25 |
+
"initializer_range": 0.02,
|
| 26 |
+
"use_cache": true,
|
| 27 |
+
"bos_token_id": 2,
|
| 28 |
+
"eos_token_id": 2,
|
| 29 |
+
"pad_token_id": 3,
|
| 30 |
+
"torch_dtype": "bfloat16",
|
| 31 |
+
"dtype": "bfloat16"
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
2,
|
| 5 |
+
32003
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 3,
|
| 8 |
+
"do_sample": true,
|
| 9 |
+
"temperature": 0.7,
|
| 10 |
+
"top_p": 0.9
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec23963e4fa6e414ca84fec6c5295c88642fb72cde87dabfeeac57d638f9e4a9
|
| 3 |
+
size 2186486232
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<bos>",
|
| 3 |
+
"eos_token": "<eos>",
|
| 4 |
+
"unk_token": "<unk>",
|
| 5 |
+
"pad_token": "<pad>",
|
| 6 |
+
"additional_special_tokens": [
|
| 7 |
+
"<|system|>",
|
| 8 |
+
"<|user|>",
|
| 9 |
+
"<|assistant|>",
|
| 10 |
+
"<|endofturn|>"
|
| 11 |
+
]
|
| 12 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 3 |
+
"model_max_length": 4096,
|
| 4 |
+
"add_bos_token": false,
|
| 5 |
+
"add_eos_token": false,
|
| 6 |
+
"clean_up_tokenization_spaces": false,
|
| 7 |
+
"bos_token": "<bos>",
|
| 8 |
+
"eos_token": "<eos>",
|
| 9 |
+
"unk_token": "<unk>",
|
| 10 |
+
"pad_token": "<pad>",
|
| 11 |
+
"additional_special_tokens": [
|
| 12 |
+
"<|system|>",
|
| 13 |
+
"<|user|>",
|
| 14 |
+
"<|assistant|>",
|
| 15 |
+
"<|endofturn|>"
|
| 16 |
+
],
|
| 17 |
+
"chat_template": "{{ '<eos>' }}{% for message in messages %}{% if message['role'] not in ['system', 'user', 'assistant'] %}{{ raise_exception('Unsupported message role: ' + message['role']) }}{% endif %}{{ '<|' ~ message['role'] ~ '|>\n' ~ message['content'] ~ '<|endofturn|>' }}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>\n' }}{% endif %}"
|
| 18 |
+
}
|