File size: 2,576 Bytes
5deba45
3a7c007
 
 
 
 
 
5deba45
 
3a7c007
 
 
 
 
 
 
 
7d4a75c
3a7c007
 
 
 
 
 
 
7d4a75c
0f440c9
7d4a75c
 
 
 
0f440c9
7d4a75c
 
 
 
3a7c007
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb5aed3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
108
109
110
111
112
113
---
base_model: None
tags:
- generated_from_trainer
model-index:
- name: checkpoints-mistral-0.3b
  results: []
license: apache-2.0
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# checkpoints-mistral-300M

This model is a fine-tuned version of [None](https://huggingface.co/None) on an unknown dataset.
It achieves the following results on the evaluation set:
- Loss: 2.205

## Model description

More information needed

## Training and evaluation data

***** train metrics *****

  epoch                    =       13.91
  train_loss               =         2.205

***** eval metrics *****

  epoch                   =      13.91
  eval_loss               =        2.4
  perplexity              =    11.0228


## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.0003
- train_batch_size: 6
- eval_batch_size: 6
- seed: 42
- distributed_type: multi-GPU
- num_devices: 2
- gradient_accumulation_steps: 16
- total_train_batch_size: 192
- total_eval_batch_size: 12
- optimizer: Adam with betas=(0.9,0.95) and epsilon=0.0001
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 4
- num_epochs: 6
- mixed_precision_training: Native AMP


### Framework versions

- Transformers 4.35.2
- Pytorch 2.1.2+cu121
- Datasets 2.14.5
- Tokenizers 0.14.1

## Usage

```python
from transformers import pipeline

pipe = pipeline("text-generation", model="ayousanz/japanese-mistral-0.3b-base")

from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
import torch

MODEL_NAME = "ayousanz/japanese-mistral-0.3b-base"
torch.set_float32_matmul_precision('high')

DEVICE = "cuda"
if torch.cuda.is_available():
    print("cuda")
    DEVICE = "cuda"
else:
    print("cpu")
    DEVICE = "cpu"

tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME,use_fast=False)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME,
    trust_remote_code=True,
).to(DEVICE)

prompt = "大規模言語モデルとは、"

inputs = tokenizer(prompt, add_special_tokens=False,return_tensors="pt").to(model.device)
with torch.no_grad():

    outputs = model.generate(
        inputs["input_ids"],
        max_new_tokens=256,
        do_sample=True,
        early_stopping=False,
        top_p=0.95,
        top_k=50,
        temperature=0.9,
        no_repeat_ngram_size=2,
        num_beams=3
    )

outputs_txt = tokenizer.decode(outputs[0])
print(outputs_txt)

```