File size: 3,930 Bytes
db5f960 12482b0 db5f960 5da5d03 db5f960 12482b0 db5f960 6032eb5 db5f960 5c83f1a db5f960 5c83f1a 8427f91 5c83f1a db5f960 1b49982 db5f960 5c83f1a db5f960 12482b0 5c83f1a db5f960 12482b0 db5f960 2ab2ae2 db5f960 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
---
license: other
base_model: microsoft/phi-1_5
tags:
- generated_from_trainer
model-index:
- name: phi-1_5-pl-v_0_1
results: []
---
# phi-1_5-pl-v_0_1
This model is based on [microsoft/phi-1_5](https://huggingface.co/microsoft/phi-1_5). It was trained from scratch on the 20231201 Polish Wikipedia dump.
## Model description
The model was trained for a context length of 1024 tokens. In addition, while the original model has a hidden size of 2048 (1.3B parameters), this model has a hidden size of 1024 (450.3M parameters).
The model used for training was as follows:
```
model_config = AutoConfig.from_pretrained(
'microsoft/phi-1_5', vocab_size=len(trained_tokenizer), max_position_embeddings=1024,
hidden_size=1024, attn_implementation="flash_attention_2", trust_remote_code=True
)
model = AutoModelForCausalLM.from_config(model_config, trust_remote_code=True)
```
## Intended uses & limitations
The model is intended for research purposes only. It may generate fictitious, incorrect, unethical, or biased texts. At its current state, it is not suitable for production purposes.
Example:
```
tokenizer = AutoTokenizer.from_pretrained(
model_name, trust_remote_code=True, use_fast=True
)
# to use flash_attention_2, may need to load the original microsoft phi-1.5 and load weights from this model
model = AutoModelForCausalLM.from_pretrained(
model_name, vocab_size=len(tokenizer), # attn_implementation="flash_attention_2",
trust_remote_code=True, torch_dtype=torch.bfloat16
).to(torch.device('cuda'))
model.eval()
generation_config = GenerationConfig.from_pretrained(
model_name, do_sample=False, repetition_penalty=1.5,
min_new_tokens=1, max_new_tokens=128
)
test_input = tokenizer("Wrocław to polski miasto. Wrocław jest ", return_tensors='pt').to(torch.device('cuda'))
test_output = model.generate(**test_input, generation_config=generation_config)
test_preds = tokenizer.batch_decode(sequences=test_output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
print(test_preds)
```
Output:
```
['Wrocław to polski miasto. Wrocław jest stolicą województwa dolnośląskiego, a także siedzibą władz powiatu wrocławskiego i gminy miejsko-wiejskiej Wrocław\n\nMiasto leży w południowo–zachodniej części Dolnego Śląska na Przedgórzu Sudeckim nad rzeką Odrą (odnoga Odry). Przez miasto przebiega droga krajowa nr 94 łącząca Berlin z Wrocławiem oraz linia kolejowa do Wrocławia Głównego przez Wrocław Główny – Kłodzko Główne/Szczecin Zachodni - Legnica. Miasto posiada połączenie kolejowe ze stacją kolejową Wrocław Gądów Mały lub Gądowem Małym poprzez węzeł kolejowy Wrocław Gądów Wielki. W mieście znajduje się stacja towarowa Wrocław Gądów Mały.\nW latach 1975−1998 miejscowość administracyjnie należała do woj. wałbrzyskiego. Od 1']
```
## Training and evaluation data
The 20231201 Polish Wikipedia dump.
## Training procedure
### Training environment
- GPU: 4 x RTX4090 (24GB per GPU, 96GB total)
- CPU: AMD EPYC 75F3 32-core (128 virtual cores)
- RAM: 258GB
- Motherboard: ROME2D32GM PCLe 4.0, 16x
- Storage: nvme 194.0GB
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0002
- distributed_type: multi-GPU (DDP)
- num_devices: 4
- train_batch_size: 2
- gradient_accumulation_steps: 8
- total_train_batch_size: 64
- optimizer: Adam with betas=(0.9,0.98) and epsilon=1e-07
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 2
- precision: bf16
- seed: 42
### Training results
- runtime: 2d 21h 26m 36s
- train_loss: 2.727
Average results on the first 8,000 rows of the training data:
- rouge1: 0.25254847037792205
- rouge2: 0.16880333936214448
- rougeLsum: 0.24328783786296845
- cosine_similarity: 0.9603840799331665
### Framework versions
- Transformers 4.36.2
- Pytorch 2.1.2
- Datasets 2.14.7
- Tokenizers 0.15.0
|