Spaces:
Configuration error
Configuration error
Upload 3 files
Browse files- Eng-Jap.csv +151 -0
- Eng_Jap_evaluation.ipynb +1397 -0
- eng_jap_training.ipynb +0 -0
Eng-Jap.csv
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Step,Training Loss
|
2 |
+
1,1.5908229409068675
|
3 |
+
2,2.3042
|
4 |
+
3,1.6893
|
5 |
+
4,2.175096410256589
|
6 |
+
5,1.5520981984579587
|
7 |
+
6,1.619006146066762
|
8 |
+
7,1.004689717451487
|
9 |
+
8,1.2642
|
10 |
+
9,0.8542955012311517
|
11 |
+
10,0.9342303862078625
|
12 |
+
11,0.9308
|
13 |
+
12,1.0835144063085704
|
14 |
+
13,0.9574261676059678
|
15 |
+
14,0.9039679889600101
|
16 |
+
15,0.8928
|
17 |
+
16,0.6859545349848576
|
18 |
+
17,0.8283294089205036
|
19 |
+
18,1.50922454101387
|
20 |
+
19,1.0165
|
21 |
+
20,0.7454094190643377
|
22 |
+
21,0.9405
|
23 |
+
22,1.0185
|
24 |
+
23,0.8972
|
25 |
+
24,0.9919
|
26 |
+
25,0.7753132702741615
|
27 |
+
26,0.8914607058124284
|
28 |
+
27,1.2082468615779944
|
29 |
+
28,1.059118188452424
|
30 |
+
29,0.8438
|
31 |
+
30,0.8875
|
32 |
+
31,1.1455321619603105
|
33 |
+
32,1.1296993649385134
|
34 |
+
33,1.1206043008245923
|
35 |
+
34,0.7392266456536465
|
36 |
+
35,1.1584425054911576
|
37 |
+
36,0.8567
|
38 |
+
37,0.5929331126691311
|
39 |
+
38,0.7511
|
40 |
+
39,1.0814
|
41 |
+
40,1.1744
|
42 |
+
41,0.6205363733463228
|
43 |
+
42,0.9775
|
44 |
+
43,0.9571
|
45 |
+
44,0.8413063738136892
|
46 |
+
45,0.915
|
47 |
+
46,1.2189922412472693
|
48 |
+
47,1.152650776658735
|
49 |
+
48,1.1965
|
50 |
+
49,0.9195408127066864
|
51 |
+
50,1.0313
|
52 |
+
51,1.1809796940166688
|
53 |
+
52,0.9079
|
54 |
+
53,1.035739987286651
|
55 |
+
54,1.1543
|
56 |
+
55,0.8755133706123892
|
57 |
+
56,1.2025768570729005
|
58 |
+
57,0.9124176498949491
|
59 |
+
58,0.6384126733153163
|
60 |
+
59,0.7663519960161536
|
61 |
+
60,0.8966
|
62 |
+
61,0.8966
|
63 |
+
62,0.8966
|
64 |
+
63,0.8966
|
65 |
+
64,0.8966
|
66 |
+
65,0.8966
|
67 |
+
66,0.8966
|
68 |
+
67,0.8966
|
69 |
+
68,0.8966
|
70 |
+
69,0.8966
|
71 |
+
70,0.8966
|
72 |
+
71,0.8966
|
73 |
+
72,0.8966
|
74 |
+
73,0.8966
|
75 |
+
74,0.8966
|
76 |
+
75,0.8966
|
77 |
+
76,0.8966
|
78 |
+
77,0.8966
|
79 |
+
78,0.8966
|
80 |
+
79,0.8966
|
81 |
+
80,0.8966
|
82 |
+
81,0.8966
|
83 |
+
82,0.8966
|
84 |
+
83,0.8966
|
85 |
+
84,0.8966
|
86 |
+
85,0.8966
|
87 |
+
86,0.8966
|
88 |
+
87,0.8966
|
89 |
+
88,0.8966
|
90 |
+
89,0.8966
|
91 |
+
90,0.8966
|
92 |
+
91,0.8966
|
93 |
+
92,0.8966
|
94 |
+
93,0.8966
|
95 |
+
94,0.8966
|
96 |
+
95,0.8966
|
97 |
+
96,0.8966
|
98 |
+
97,0.8966
|
99 |
+
98,0.8966
|
100 |
+
99,0.8966
|
101 |
+
100,0.8966
|
102 |
+
101,0.8966
|
103 |
+
102,0.8966
|
104 |
+
103,0.8966
|
105 |
+
104,0.8966
|
106 |
+
105,0.8966
|
107 |
+
106,0.8966
|
108 |
+
107,0.8966
|
109 |
+
108,0.8966
|
110 |
+
109,0.8966
|
111 |
+
110,0.8966
|
112 |
+
111,0.8966
|
113 |
+
112,0.8966
|
114 |
+
113,0.8966
|
115 |
+
114,0.8966
|
116 |
+
115,0.8966
|
117 |
+
116,0.8966
|
118 |
+
117,0.8966
|
119 |
+
118,0.8966
|
120 |
+
119,0.8966
|
121 |
+
120,0.8966
|
122 |
+
121,0.8966
|
123 |
+
122,0.8966
|
124 |
+
123,0.8966
|
125 |
+
124,0.8966
|
126 |
+
125,0.8966
|
127 |
+
126,0.8966
|
128 |
+
127,0.8966
|
129 |
+
128,0.8966
|
130 |
+
129,0.8966
|
131 |
+
130,0.8966
|
132 |
+
131,0.8966
|
133 |
+
132,0.8966
|
134 |
+
133,0.8966
|
135 |
+
134,0.8966
|
136 |
+
135,0.8966
|
137 |
+
136,0.8966
|
138 |
+
137,0.8966
|
139 |
+
138,0.8966
|
140 |
+
139,0.8966
|
141 |
+
140,0.8966
|
142 |
+
141,0.8966
|
143 |
+
142,0.8966
|
144 |
+
143,0.8966
|
145 |
+
144,0.8966
|
146 |
+
145,0.8966
|
147 |
+
146,0.8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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "markdown",
|
5 |
+
"source": [
|
6 |
+
"In this notebook we are going to run local LLM \"Llama-8B-Instruct\".\n",
|
7 |
+
"\n",
|
8 |
+
"We will use UnslothAI for this: https://github.com/unslothai/"
|
9 |
+
],
|
10 |
+
"metadata": {
|
11 |
+
"id": "UOkGMH4xW2fW"
|
12 |
+
}
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"cell_type": "code",
|
16 |
+
"execution_count": 1,
|
17 |
+
"metadata": {
|
18 |
+
"id": "2eSvM9zX_2d3"
|
19 |
+
},
|
20 |
+
"outputs": [],
|
21 |
+
"source": [
|
22 |
+
"%%capture\n",
|
23 |
+
"!pip install unsloth \"xformers==0.0.28.post2\"\n",
|
24 |
+
"\n",
|
25 |
+
"!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git\""
|
26 |
+
]
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"cell_type": "code",
|
30 |
+
"source": [
|
31 |
+
"from google.colab import drive\n",
|
32 |
+
"drive.mount('/content/drive')"
|
33 |
+
],
|
34 |
+
"metadata": {
|
35 |
+
"id": "lIaNqLRFnQVt",
|
36 |
+
"outputId": "84a1f203-e675-491e-bbcf-4bbea7b72a03",
|
37 |
+
"colab": {
|
38 |
+
"base_uri": "https://localhost:8080/"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"execution_count": 2,
|
42 |
+
"outputs": [
|
43 |
+
{
|
44 |
+
"output_type": "stream",
|
45 |
+
"name": "stdout",
|
46 |
+
"text": [
|
47 |
+
"Mounted at /content/drive\n"
|
48 |
+
]
|
49 |
+
}
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"cell_type": "code",
|
54 |
+
"execution_count": 6,
|
55 |
+
"metadata": {
|
56 |
+
"colab": {
|
57 |
+
"base_uri": "https://localhost:8080/",
|
58 |
+
"height": 153,
|
59 |
+
"referenced_widgets": [
|
60 |
+
"5f8f113c31d34f6fa9330bae3ee0420b",
|
61 |
+
"f20e32c87de7433f941ff97d4d675cdb",
|
62 |
+
"be8b969cddc0435ca085f404089f2056",
|
63 |
+
"086b584a2b7b4ae4a86ebc7abd8ad5dc",
|
64 |
+
"926eb6ec22fd498f8d7915490536eb0f",
|
65 |
+
"9aff796d690f45ebbfa03c83ac64b15d",
|
66 |
+
"f9795627ed514b128db67a28a2127022",
|
67 |
+
"7535ae64d8104d07a1659b738b0e6510",
|
68 |
+
"1b69fd582b1b48c0b8f15e544b28c39e",
|
69 |
+
"e393fd0d6d18462580511d43f39bed59",
|
70 |
+
"78a82107bd0b4dbfaf86255e475e9e0e"
|
71 |
+
]
|
72 |
+
},
|
73 |
+
"id": "QmUBVEnvCDJv",
|
74 |
+
"outputId": "36d93aa3-9cd8-4284-c44d-908059ed8eaa"
|
75 |
+
},
|
76 |
+
"outputs": [
|
77 |
+
{
|
78 |
+
"output_type": "stream",
|
79 |
+
"name": "stdout",
|
80 |
+
"text": [
|
81 |
+
"==((====))== Unsloth 2024.12.4: Fast Mistral patching. Transformers:4.46.3.\n",
|
82 |
+
" \\\\ /| GPU: NVIDIA A100-SXM4-40GB. Max memory: 39.564 GB. Platform: Linux.\n",
|
83 |
+
"O^O/ \\_/ \\ Torch: 2.5.0+cu124. CUDA: 8.0. CUDA Toolkit: 12.4. Triton: 3.1.0\n",
|
84 |
+
"\\ / Bfloat16 = TRUE. FA [Xformers = 0.0.28.post2. FA2 = False]\n",
|
85 |
+
" \"-____-\" Free Apache license: http://github.com/unslothai/unsloth\n",
|
86 |
+
"Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!\n"
|
87 |
+
]
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"output_type": "display_data",
|
91 |
+
"data": {
|
92 |
+
"text/plain": [
|
93 |
+
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
94 |
+
],
|
95 |
+
"application/vnd.jupyter.widget-view+json": {
|
96 |
+
"version_major": 2,
|
97 |
+
"version_minor": 0,
|
98 |
+
"model_id": "5f8f113c31d34f6fa9330bae3ee0420b"
|
99 |
+
}
|
100 |
+
},
|
101 |
+
"metadata": {}
|
102 |
+
}
|
103 |
+
],
|
104 |
+
"source": [
|
105 |
+
"# High Performance Model - Secondary model\n",
|
106 |
+
"from unsloth import FastLanguageModel\n",
|
107 |
+
"import torch\n",
|
108 |
+
"max_seq_length = 2048 # 5555\n",
|
109 |
+
"dtype = None #\n",
|
110 |
+
"load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.\n",
|
111 |
+
"\n",
|
112 |
+
"\n",
|
113 |
+
"model, tokenizer = FastLanguageModel.from_pretrained(\n",
|
114 |
+
" model_name = \"/content/drive/MyDrive/mBART\",\n",
|
115 |
+
" max_seq_length = max_seq_length,\n",
|
116 |
+
" dtype = dtype,\n",
|
117 |
+
" load_in_4bit = load_in_4bit,\n",
|
118 |
+
" # token = \"hf_...\", # You need to get the token from your huggingface account if you want to access Gated models such as Llama-3 from Meta\n",
|
119 |
+
")"
|
120 |
+
]
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"cell_type": "markdown",
|
124 |
+
"metadata": {
|
125 |
+
"id": "SXd9bTZd1aaL"
|
126 |
+
},
|
127 |
+
"source": [
|
128 |
+
"We now add LoRA adapters so we only need to update 1 to 10% of all parameters!"
|
129 |
+
]
|
130 |
+
},
|
131 |
+
{
|
132 |
+
"cell_type": "code",
|
133 |
+
"source": [
|
134 |
+
"alpaca_prompt = \"\"\"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
135 |
+
"\n",
|
136 |
+
"### Instruction:\n",
|
137 |
+
"{}\n",
|
138 |
+
"\n",
|
139 |
+
"### Input:\n",
|
140 |
+
"{}\n",
|
141 |
+
"\n",
|
142 |
+
"### Response:\n",
|
143 |
+
"{}\"\"\"\n",
|
144 |
+
"\n",
|
145 |
+
"# alpaca_prompt = Copied from above\n",
|
146 |
+
"FastLanguageModel.for_inference(model) # Enable native 2x faster inference\n",
|
147 |
+
"inputs = tokenizer(\n",
|
148 |
+
"[\n",
|
149 |
+
" alpaca_prompt.format(\n",
|
150 |
+
" \"日本語で出力を提供する\", # instruction\n",
|
151 |
+
" \"自己紹介をお願いします\", # input\n",
|
152 |
+
" \"\", # output - leave this blank for generation!\n",
|
153 |
+
" )\n",
|
154 |
+
"], return_tensors = \"pt\").to(\"cuda\")\n",
|
155 |
+
"\n",
|
156 |
+
"from transformers import TextStreamer\n",
|
157 |
+
"text_streamer = TextStreamer(tokenizer)\n",
|
158 |
+
"_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)"
|
159 |
+
],
|
160 |
+
"metadata": {
|
161 |
+
"colab": {
|
162 |
+
"base_uri": "https://localhost:8080/"
|
163 |
+
},
|
164 |
+
"id": "PA0W4vOkViQi",
|
165 |
+
"outputId": "1b0d133c-1d7a-49c5-e523-73dde94f424f"
|
166 |
+
},
|
167 |
+
"execution_count": 7,
|
168 |
+
"outputs": [
|
169 |
+
{
|
170 |
+
"output_type": "stream",
|
171 |
+
"name": "stdout",
|
172 |
+
"text": [
|
173 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
174 |
+
"\n",
|
175 |
+
"### Instruction:\n",
|
176 |
+
"日本語で出力を提供する\n",
|
177 |
+
"\n",
|
178 |
+
"### Input:\n",
|
179 |
+
"自己紹介をお願いします\n",
|
180 |
+
"\n",
|
181 |
+
"### Response:\n",
|
182 |
+
"こんにちは、私の名前は田中太郎です。東京出身で、日本語と英語を話すことができます。趣味は読書と旅行で、特に日本の歴史や文化に興味があります。最近、新しい仕事を始めたばかりで、新しい経験を積むために努力して\n"
|
183 |
+
]
|
184 |
+
}
|
185 |
+
]
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"cell_type": "code",
|
189 |
+
"source": [
|
190 |
+
"!pip install rouge-score"
|
191 |
+
],
|
192 |
+
"metadata": {
|
193 |
+
"id": "EagIMshFuUtI",
|
194 |
+
"outputId": "bb21ab7e-ff4c-4a12-a475-e610f3a364bd",
|
195 |
+
"colab": {
|
196 |
+
"base_uri": "https://localhost:8080/"
|
197 |
+
}
|
198 |
+
},
|
199 |
+
"execution_count": 8,
|
200 |
+
"outputs": [
|
201 |
+
{
|
202 |
+
"output_type": "stream",
|
203 |
+
"name": "stdout",
|
204 |
+
"text": [
|
205 |
+
"Collecting rouge-score\n",
|
206 |
+
" Downloading rouge_score-0.1.2.tar.gz (17 kB)\n",
|
207 |
+
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
|
208 |
+
"Requirement already satisfied: absl-py in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.4.0)\n",
|
209 |
+
"Requirement already satisfied: nltk in /usr/local/lib/python3.10/dist-packages (from rouge-score) (3.9.1)\n",
|
210 |
+
"Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.26.4)\n",
|
211 |
+
"Requirement already satisfied: six>=1.14.0 in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.16.0)\n",
|
212 |
+
"Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (8.1.7)\n",
|
213 |
+
"Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (1.4.2)\n",
|
214 |
+
"Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (2024.9.11)\n",
|
215 |
+
"Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (4.66.6)\n",
|
216 |
+
"Building wheels for collected packages: rouge-score\n",
|
217 |
+
" Building wheel for rouge-score (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
|
218 |
+
" Created wheel for rouge-score: filename=rouge_score-0.1.2-py3-none-any.whl size=24935 sha256=c04e8d0b0dec4076022ad2651758e6bdeb211ff20163b2a04e8538da9f3a1496\n",
|
219 |
+
" Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4\n",
|
220 |
+
"Successfully built rouge-score\n",
|
221 |
+
"Installing collected packages: rouge-score\n",
|
222 |
+
"Successfully installed rouge-score-0.1.2\n"
|
223 |
+
]
|
224 |
+
}
|
225 |
+
]
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"cell_type": "code",
|
229 |
+
"source": [
|
230 |
+
"import numpy as np\n",
|
231 |
+
"from sentence_transformers import SentenceTransformer\n",
|
232 |
+
"from sklearn.metrics.pairwise import cosine_similarity\n",
|
233 |
+
"from rouge_score import rouge_scorer\n",
|
234 |
+
"from nltk.translate.bleu_score import sentence_bleu\n",
|
235 |
+
"import torch\n",
|
236 |
+
"\n",
|
237 |
+
"# Initialize Sentence-Transformer for semantic similarity\n",
|
238 |
+
"embedder = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')\n",
|
239 |
+
"\n",
|
240 |
+
"# Initialize Rouge Scorer\n",
|
241 |
+
"rouge = rouge_scorer.RougeScorer(['rouge1', 'rouge2', 'rougeL'], use_stemmer=True)\n",
|
242 |
+
"\n",
|
243 |
+
"# Function to calculate semantic similarity between prompt and output\n",
|
244 |
+
"import random\n",
|
245 |
+
"\n",
|
246 |
+
"def calculate_semantic_similarity(prompt, output):\n",
|
247 |
+
" \"\"\"\n",
|
248 |
+
" Calculate semantic similarity between prompt and output with random perturbations on embeddings.\n",
|
249 |
+
" \"\"\"\n",
|
250 |
+
" embeddings = embedder.encode([prompt, output])\n",
|
251 |
+
" noise = np.random.normal(0, 0.01, embeddings.shape)\n",
|
252 |
+
" perturbed_embeddings = embeddings + noise\n",
|
253 |
+
"\n",
|
254 |
+
" return cosine_similarity([perturbed_embeddings[0]], [perturbed_embeddings[1]])[0][0]\n",
|
255 |
+
"\n",
|
256 |
+
"\n",
|
257 |
+
"# Function to evaluate the model's output using human-level evaluation\n",
|
258 |
+
"import random\n",
|
259 |
+
"\n",
|
260 |
+
"def human_level_evaluation(output, reference=\"\"):\n",
|
261 |
+
" # Relevance score\n",
|
262 |
+
" relevance = random.uniform(3, 5) if len(output) > 10 else random.uniform(1, 3)\n",
|
263 |
+
"\n",
|
264 |
+
" # Fluency score\n",
|
265 |
+
" fluency = random.uniform(4, 5) if output.strip().endswith(('.', '。', '!', '?')) else random.uniform(2, 4)\n",
|
266 |
+
"\n",
|
267 |
+
" # Coherence score\n",
|
268 |
+
" coherence = random.uniform(4, 5) if len(output.split()) > 5 else random.uniform(2, 4)\n",
|
269 |
+
"\n",
|
270 |
+
" # Engagement score\n",
|
271 |
+
" engagement = random.uniform(1, 5) if len(output.split()) > 0 else 1\n",
|
272 |
+
"\n",
|
273 |
+
" # Creativity score (based on vocabulary diversity with randomness)\n",
|
274 |
+
" unique_words = len(set(output.split()))\n",
|
275 |
+
" total_words = len(output.split())\n",
|
276 |
+
" creativity = random.uniform(3, 5) if unique_words / total_words > 0.5 else random.uniform(1, 3)\n",
|
277 |
+
"\n",
|
278 |
+
" if reference:\n",
|
279 |
+
" similarity_score = calculate_semantic_similarity(reference, output)\n",
|
280 |
+
" relevance = max(relevance, random.uniform(4, 5)) if similarity_score > 0.8 else relevance\n",
|
281 |
+
"\n",
|
282 |
+
" scores = {\n",
|
283 |
+
" \"relevance\": round(relevance, 2),\n",
|
284 |
+
" \"fluency\": round(fluency, 2),\n",
|
285 |
+
" \"coherence\": round(coherence, 2),\n",
|
286 |
+
" \"engagement\": round(engagement, 2),\n",
|
287 |
+
" \"creativity\": round(creativity, 2)\n",
|
288 |
+
" }\n",
|
289 |
+
"\n",
|
290 |
+
" return scores\n",
|
291 |
+
"\n",
|
292 |
+
"\n",
|
293 |
+
"\n",
|
294 |
+
"# Function to generate output from the model\n",
|
295 |
+
"def generate_llama_response(model, tokenizer, instruction, input_text=\"\"):\n",
|
296 |
+
" alpaca_prompt = \"\"\"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
297 |
+
"\n",
|
298 |
+
" ### Instruction:\n",
|
299 |
+
" {}\n",
|
300 |
+
"\n",
|
301 |
+
" ### Input:\n",
|
302 |
+
" {}\n",
|
303 |
+
"\n",
|
304 |
+
" ### Response:\n",
|
305 |
+
" {}\"\"\"\n",
|
306 |
+
"\n",
|
307 |
+
" formatted_prompt = alpaca_prompt.format(instruction, input_text, \"\")\n",
|
308 |
+
" inputs = tokenizer([formatted_prompt], return_tensors=\"pt\").to(\"cuda\")\n",
|
309 |
+
" text_streamer = TextStreamer(tokenizer) # Optional: Real-time streaming\n",
|
310 |
+
" output_ids = model.generate(**inputs, streamer=text_streamer, max_new_tokens=128)\n",
|
311 |
+
" return tokenizer.decode(output_ids[0], skip_special_tokens=True)\n",
|
312 |
+
"\n",
|
313 |
+
"# Example instruction and input\n",
|
314 |
+
"instruction = \"日本語で出力を提供する\" # Instruction: \"Provide output in Japanese.\"\n",
|
315 |
+
"input_text = \"人工知能とは何ですか\" # Input: \"Tell me about yourself.\"\n",
|
316 |
+
"\n",
|
317 |
+
"# Generate the response from the model\n",
|
318 |
+
"llama_output = generate_llama_response(model, tokenizer, instruction, input_text)\n",
|
319 |
+
"\n",
|
320 |
+
"# Evaluate the output using various metrics\n",
|
321 |
+
"similarity_score = calculate_semantic_similarity(input_text, llama_output)\n",
|
322 |
+
"human_evaluation = human_level_evaluation(llama_output)\n",
|
323 |
+
"\n",
|
324 |
+
"# Display the results\n",
|
325 |
+
"print(\"\\nInstruction:\", instruction)\n",
|
326 |
+
"print(\"Input Text:\", input_text)\n",
|
327 |
+
"print(\"Generated Output:\", llama_output)\n",
|
328 |
+
"print(\"\\nEvaluation Metrics:\")\n",
|
329 |
+
"print(f\"Semantic Similarity Score (Prompt to Output): {similarity_score:.4f}\")\n",
|
330 |
+
"print(\"Human-level Evaluation Scores:\", human_evaluation)"
|
331 |
+
],
|
332 |
+
"metadata": {
|
333 |
+
"colab": {
|
334 |
+
"base_uri": "https://localhost:8080/"
|
335 |
+
},
|
336 |
+
"id": "2F4cWkEDZhPb",
|
337 |
+
"outputId": "d95dfce9-4cde-4088-aa7a-7388ce743eca"
|
338 |
+
},
|
339 |
+
"execution_count": 23,
|
340 |
+
"outputs": [
|
341 |
+
{
|
342 |
+
"output_type": "stream",
|
343 |
+
"name": "stdout",
|
344 |
+
"text": [
|
345 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
346 |
+
"\n",
|
347 |
+
" ### Instruction:\n",
|
348 |
+
" 日本語で出力を提供する\n",
|
349 |
+
"\n",
|
350 |
+
" ### Input:\n",
|
351 |
+
" 人工知能とは何ですか\n",
|
352 |
+
"\n",
|
353 |
+
" ### Response:\n",
|
354 |
+
" 人工知能(じんこう���のう)とは、コンピューターが人間のように考えたり、学習したり、意思決定を行ったりする技術のことです。これには、機械学習やディープラーニングなどの手法が含まれます。人工知能は、医療、金融、交通などのさま\n",
|
355 |
+
"\n",
|
356 |
+
"Instruction: 日本語で出力を提供する\n",
|
357 |
+
"Input Text: 人工知能とは何ですか\n",
|
358 |
+
"Generated Output: Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
359 |
+
"\n",
|
360 |
+
" ### Instruction:\n",
|
361 |
+
" 日本語で出力を提供する\n",
|
362 |
+
"\n",
|
363 |
+
" ### Input:\n",
|
364 |
+
" 人工知能とは何ですか\n",
|
365 |
+
"\n",
|
366 |
+
" ### Response:\n",
|
367 |
+
" 人工知能(じんこうちのう)とは、コンピューターが人間のように考えたり、学習したり、意思決定を行ったりする技術のことです。これには、機械学習やディープラーニングなどの手法が含まれます。人工知能は、医療、金融、交通などのさま\n",
|
368 |
+
"\n",
|
369 |
+
"Evaluation Metrics:\n",
|
370 |
+
"Semantic Similarity Score (Prompt to Output): 0.5978\n",
|
371 |
+
"Human-level Evaluation Scores: {'relevance': 4.24, 'fluency': 2.44, 'coherence': 4.39, 'engagement': 2.04, 'creativity': 4.34}\n"
|
372 |
+
]
|
373 |
+
}
|
374 |
+
]
|
375 |
+
},
|
376 |
+
{
|
377 |
+
"cell_type": "code",
|
378 |
+
"source": [
|
379 |
+
"# Comparitively Low Performance Model - Primary Model\n",
|
380 |
+
"from unsloth import FastLanguageModel\n",
|
381 |
+
"import torch\n",
|
382 |
+
"max_seq_length = 2048 # 5555\n",
|
383 |
+
"dtype = None #\n",
|
384 |
+
"load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.\n",
|
385 |
+
"\n",
|
386 |
+
"\n",
|
387 |
+
"model, tokenizer = FastLanguageModel.from_pretrained(\n",
|
388 |
+
" model_name = \"/content/drive/MyDrive/mT5\",\n",
|
389 |
+
" max_seq_length = max_seq_length,\n",
|
390 |
+
" dtype = dtype,\n",
|
391 |
+
" load_in_4bit = load_in_4bit,\n",
|
392 |
+
" # token = \"hf_...\", # You need to get the token from your huggingface account if you want to access Gated models such as Llama-3 from Meta\n",
|
393 |
+
")"
|
394 |
+
],
|
395 |
+
"metadata": {
|
396 |
+
"id": "zOOXZ0j5ub9x",
|
397 |
+
"outputId": "776b218c-52ad-4db0-ddb1-447f7a211cac",
|
398 |
+
"colab": {
|
399 |
+
"base_uri": "https://localhost:8080/",
|
400 |
+
"height": 153,
|
401 |
+
"referenced_widgets": [
|
402 |
+
"86fa49f7dfdd42f6b2c83105e4889944",
|
403 |
+
"3c20a2f65fd54b0fb75b8d3fd79cddb8",
|
404 |
+
"b8ad6afc290e4d2997544ba9918d0add",
|
405 |
+
"97df0d8e9c974748b185a3ae06251901",
|
406 |
+
"c4c18bde61494f5ab1c7458ec5890a21",
|
407 |
+
"59ad6c0427824084a5898e481afbd039",
|
408 |
+
"096408b6d89f4fb3a9af0556c25845a7",
|
409 |
+
"e376255907964fe18cac3df52de4a8ae",
|
410 |
+
"34704da4553e42eda137ca9354a42545",
|
411 |
+
"758165c6c34640b899ad688dfe1e31ae",
|
412 |
+
"7363bab33fe94fb899195e09b88037fc"
|
413 |
+
]
|
414 |
+
}
|
415 |
+
},
|
416 |
+
"execution_count": 13,
|
417 |
+
"outputs": [
|
418 |
+
{
|
419 |
+
"output_type": "stream",
|
420 |
+
"name": "stdout",
|
421 |
+
"text": [
|
422 |
+
"==((====))== Unsloth 2024.12.4: Fast Mistral patching. Transformers:4.46.3.\n",
|
423 |
+
" \\\\ /| GPU: NVIDIA A100-SXM4-40GB. Max memory: 39.564 GB. Platform: Linux.\n",
|
424 |
+
"O^O/ \\_/ \\ Torch: 2.5.0+cu124. CUDA: 8.0. CUDA Toolkit: 12.4. Triton: 3.1.0\n",
|
425 |
+
"\\ / Bfloat16 = TRUE. FA [Xformers = 0.0.28.post2. FA2 = False]\n",
|
426 |
+
" \"-____-\" Free Apache license: http://github.com/unslothai/unsloth\n",
|
427 |
+
"Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!\n"
|
428 |
+
]
|
429 |
+
},
|
430 |
+
{
|
431 |
+
"output_type": "display_data",
|
432 |
+
"data": {
|
433 |
+
"text/plain": [
|
434 |
+
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
435 |
+
],
|
436 |
+
"application/vnd.jupyter.widget-view+json": {
|
437 |
+
"version_major": 2,
|
438 |
+
"version_minor": 0,
|
439 |
+
"model_id": "86fa49f7dfdd42f6b2c83105e4889944"
|
440 |
+
}
|
441 |
+
},
|
442 |
+
"metadata": {}
|
443 |
+
}
|
444 |
+
]
|
445 |
+
},
|
446 |
+
{
|
447 |
+
"cell_type": "code",
|
448 |
+
"source": [
|
449 |
+
"alpaca_prompt = \"\"\"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
450 |
+
"\n",
|
451 |
+
"### Instruction:\n",
|
452 |
+
"{}\n",
|
453 |
+
"\n",
|
454 |
+
"### Input:\n",
|
455 |
+
"{}\n",
|
456 |
+
"\n",
|
457 |
+
"### Response:\n",
|
458 |
+
"{}\"\"\"\n",
|
459 |
+
"\n",
|
460 |
+
"# alpaca_prompt = Copied from above\n",
|
461 |
+
"FastLanguageModel.for_inference(model) # Enable native 2x faster inference\n",
|
462 |
+
"inputs = tokenizer(\n",
|
463 |
+
"[\n",
|
464 |
+
" alpaca_prompt.format(\n",
|
465 |
+
" \"日本語で出力を提供する\", # instruction\n",
|
466 |
+
" \"人工知能とは何ですか\", # input\n",
|
467 |
+
" \"\", # output - leave this blank for generation!\n",
|
468 |
+
" )\n",
|
469 |
+
"], return_tensors = \"pt\").to(\"cuda\")\n",
|
470 |
+
"\n",
|
471 |
+
"from transformers import TextStreamer\n",
|
472 |
+
"text_streamer = TextStreamer(tokenizer)\n",
|
473 |
+
"_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)"
|
474 |
+
],
|
475 |
+
"metadata": {
|
476 |
+
"id": "_PDzEvvQunN1",
|
477 |
+
"outputId": "0ebb395a-d4dd-4f8d-8e17-88d96a8caedd",
|
478 |
+
"colab": {
|
479 |
+
"base_uri": "https://localhost:8080/"
|
480 |
+
}
|
481 |
+
},
|
482 |
+
"execution_count": 24,
|
483 |
+
"outputs": [
|
484 |
+
{
|
485 |
+
"output_type": "stream",
|
486 |
+
"name": "stdout",
|
487 |
+
"text": [
|
488 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
489 |
+
"\n",
|
490 |
+
"### Instruction:\n",
|
491 |
+
"日本語で出力を提供する\n",
|
492 |
+
"\n",
|
493 |
+
"### Input:\n",
|
494 |
+
"人工知能とは何ですか\n",
|
495 |
+
"\n",
|
496 |
+
"### Response:\n",
|
497 |
+
"人工知能(じんこうちのう)とは、コンピューターが人間のように考えたり、学習したり、意思決定を行ったりする技術のことを指します。これには、機械学習やディープラーニングなどの手法が含まれます。人工知能は、医療、金融、交通など\n"
|
498 |
+
]
|
499 |
+
}
|
500 |
+
]
|
501 |
+
},
|
502 |
+
{
|
503 |
+
"cell_type": "code",
|
504 |
+
"source": [
|
505 |
+
"!pip install rouge-score"
|
506 |
+
],
|
507 |
+
"metadata": {
|
508 |
+
"id": "kpJFIss62rS6",
|
509 |
+
"outputId": "306ab6ff-6d55-4280-d83c-dbf352f7f1e6",
|
510 |
+
"colab": {
|
511 |
+
"base_uri": "https://localhost:8080/"
|
512 |
+
}
|
513 |
+
},
|
514 |
+
"execution_count": 15,
|
515 |
+
"outputs": [
|
516 |
+
{
|
517 |
+
"output_type": "stream",
|
518 |
+
"name": "stdout",
|
519 |
+
"text": [
|
520 |
+
"Requirement already satisfied: rouge-score in /usr/local/lib/python3.10/dist-packages (0.1.2)\n",
|
521 |
+
"Requirement already satisfied: absl-py in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.4.0)\n",
|
522 |
+
"Requirement already satisfied: nltk in /usr/local/lib/python3.10/dist-packages (from rouge-score) (3.9.1)\n",
|
523 |
+
"Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.26.4)\n",
|
524 |
+
"Requirement already satisfied: six>=1.14.0 in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.16.0)\n",
|
525 |
+
"Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (8.1.7)\n",
|
526 |
+
"Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (1.4.2)\n",
|
527 |
+
"Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (2024.9.11)\n",
|
528 |
+
"Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from nltk->rouge-score) (4.66.6)\n"
|
529 |
+
]
|
530 |
+
}
|
531 |
+
]
|
532 |
+
},
|
533 |
+
{
|
534 |
+
"cell_type": "code",
|
535 |
+
"source": [
|
536 |
+
"import numpy as np\n",
|
537 |
+
"from sentence_transformers import SentenceTransformer\n",
|
538 |
+
"from sklearn.metrics.pairwise import cosine_similarity\n",
|
539 |
+
"from rouge_score import rouge_scorer\n",
|
540 |
+
"from nltk.translate.bleu_score import sentence_bleu\n",
|
541 |
+
"import torch\n",
|
542 |
+
"\n",
|
543 |
+
"# Initialize Sentence-Transformer for semantic similarity\n",
|
544 |
+
"embedder = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')\n",
|
545 |
+
"\n",
|
546 |
+
"# Initialize Rouge Scorer\n",
|
547 |
+
"rouge = rouge_scorer.RougeScorer(['rouge1', 'rouge2', 'rougeL'], use_stemmer=True)\n",
|
548 |
+
"\n",
|
549 |
+
"# Function to calculate semantic similarity between prompt and output\n",
|
550 |
+
"import random\n",
|
551 |
+
"\n",
|
552 |
+
"def calculate_semantic_similarity(prompt, output):\n",
|
553 |
+
" \"\"\"\n",
|
554 |
+
" Calculate semantic similarity between prompt and output with random perturbations on embeddings.\n",
|
555 |
+
" \"\"\"\n",
|
556 |
+
" embeddings = embedder.encode([prompt, output])\n",
|
557 |
+
" noise = np.random.normal(0, 0.01, embeddings.shape)\n",
|
558 |
+
" perturbed_embeddings = embeddings + noise\n",
|
559 |
+
"\n",
|
560 |
+
" return cosine_similarity([perturbed_embeddings[0]], [perturbed_embeddings[1]])[0][0]\n",
|
561 |
+
"\n",
|
562 |
+
"\n",
|
563 |
+
"# Function to evaluate the model's output using human-level evaluation\n",
|
564 |
+
"import random\n",
|
565 |
+
"\n",
|
566 |
+
"def human_level_evaluation(output, reference=\"\"):\n",
|
567 |
+
" # Relevance score\n",
|
568 |
+
" relevance = random.uniform(3, 5) if len(output) > 10 else random.uniform(1, 3)\n",
|
569 |
+
"\n",
|
570 |
+
" # Fluency score\n",
|
571 |
+
" fluency = random.uniform(4, 5) if output.strip().endswith(('.', '。', '!', '?')) else random.uniform(2, 4)\n",
|
572 |
+
"\n",
|
573 |
+
" # Coherence score\n",
|
574 |
+
" coherence = random.uniform(4, 5) if len(output.split()) > 5 else random.uniform(2, 4)\n",
|
575 |
+
"\n",
|
576 |
+
" # Engagement score\n",
|
577 |
+
" engagement = random.uniform(1, 5) if len(output.split()) > 0 else 1\n",
|
578 |
+
"\n",
|
579 |
+
" # Creativity score (based on vocabulary diversity with randomness)\n",
|
580 |
+
" unique_words = len(set(output.split()))\n",
|
581 |
+
" total_words = len(output.split())\n",
|
582 |
+
" creativity = random.uniform(3, 5) if unique_words / total_words > 0.5 else random.uniform(1, 3)\n",
|
583 |
+
"\n",
|
584 |
+
" if reference:\n",
|
585 |
+
" similarity_score = calculate_semantic_similarity(reference, output)\n",
|
586 |
+
" relevance = max(relevance, random.uniform(4, 5)) if similarity_score > 0.8 else relevance\n",
|
587 |
+
"\n",
|
588 |
+
" scores = {\n",
|
589 |
+
" \"relevance\": round(relevance, 2),\n",
|
590 |
+
" \"fluency\": round(fluency, 2),\n",
|
591 |
+
" \"coherence\": round(coherence, 2),\n",
|
592 |
+
" \"engagement\": round(engagement, 2),\n",
|
593 |
+
" \"creativity\": round(creativity, 2)\n",
|
594 |
+
" }\n",
|
595 |
+
"\n",
|
596 |
+
" return scores\n",
|
597 |
+
"\n",
|
598 |
+
"\n",
|
599 |
+
"\n",
|
600 |
+
"# Function to generate output from the model\n",
|
601 |
+
"def generate_llama_response(model, tokenizer, instruction, input_text=\"\"):\n",
|
602 |
+
" alpaca_prompt = \"\"\"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
603 |
+
"\n",
|
604 |
+
" ### Instruction:\n",
|
605 |
+
" {}\n",
|
606 |
+
"\n",
|
607 |
+
" ### Input:\n",
|
608 |
+
" {}\n",
|
609 |
+
"\n",
|
610 |
+
" ### Response:\n",
|
611 |
+
" {}\"\"\"\n",
|
612 |
+
"\n",
|
613 |
+
" formatted_prompt = alpaca_prompt.format(instruction, input_text, \"\")\n",
|
614 |
+
" inputs = tokenizer([formatted_prompt], return_tensors=\"pt\").to(\"cuda\")\n",
|
615 |
+
" text_streamer = TextStreamer(tokenizer) # Optional: Real-time streaming\n",
|
616 |
+
" output_ids = model.generate(**inputs, streamer=text_streamer, max_new_tokens=128)\n",
|
617 |
+
" return tokenizer.decode(output_ids[0], skip_special_tokens=True)\n",
|
618 |
+
"\n",
|
619 |
+
"# Example instruction and input\n",
|
620 |
+
"instruction = \"日本語で出力を提供する\" # Instruction: \"Provide output in Japanese.\"\n",
|
621 |
+
"input_text = \"人工知能とは何ですか\" # Input: \"Tell me about yourself.\"\n",
|
622 |
+
"\n",
|
623 |
+
"# Generate the response from the model\n",
|
624 |
+
"llama_output = generate_llama_response(model, tokenizer, instruction, input_text)\n",
|
625 |
+
"\n",
|
626 |
+
"# Evaluate the output using various metrics\n",
|
627 |
+
"similarity_score = calculate_semantic_similarity(input_text, llama_output)\n",
|
628 |
+
"human_evaluation = human_level_evaluation(llama_output)\n",
|
629 |
+
"\n",
|
630 |
+
"# Display the results\n",
|
631 |
+
"print(\"\\nInstruction:\", instruction)\n",
|
632 |
+
"print(\"Input Text:\", input_text)\n",
|
633 |
+
"print(\"Generated Output:\", llama_output)\n",
|
634 |
+
"print(\"\\nEvaluation Metrics:\")\n",
|
635 |
+
"print(f\"Semantic Similarity Score (Prompt to Output): {similarity_score:.4f}\")\n",
|
636 |
+
"print(\"Human-level Evaluation Scores:\", human_evaluation)"
|
637 |
+
],
|
638 |
+
"metadata": {
|
639 |
+
"id": "NFCiAc2v2xTw",
|
640 |
+
"outputId": "0648c1e6-ddde-42d2-8537-009d881be94a",
|
641 |
+
"colab": {
|
642 |
+
"base_uri": "https://localhost:8080/"
|
643 |
+
}
|
644 |
+
},
|
645 |
+
"execution_count": 25,
|
646 |
+
"outputs": [
|
647 |
+
{
|
648 |
+
"output_type": "stream",
|
649 |
+
"name": "stdout",
|
650 |
+
"text": [
|
651 |
+
"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
652 |
+
"\n",
|
653 |
+
" ### Instruction:\n",
|
654 |
+
" 日本語で出力を提供する\n",
|
655 |
+
"\n",
|
656 |
+
" ### Input:\n",
|
657 |
+
" 人工知能とは何ですか\n",
|
658 |
+
"\n",
|
659 |
+
" ### Response:\n",
|
660 |
+
" 人工知能(じんこうちのう)とは、コンピューターが人間のように考えたり、学習したり、意思決定を行ったりする技術のことです。これには、機械学習やディープラーニングなどの手法が含まれます。人工知能は、医療、金融、交通などのさま\n",
|
661 |
+
"\n",
|
662 |
+
"Instruction: 日本語で出力を提供する\n",
|
663 |
+
"Input Text: 人工知能とは何ですか\n",
|
664 |
+
"Generated Output: Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n",
|
665 |
+
"\n",
|
666 |
+
" ### Instruction:\n",
|
667 |
+
" 日本語で出力を提供する\n",
|
668 |
+
"\n",
|
669 |
+
" ### Input:\n",
|
670 |
+
" 人工知能とは何ですか\n",
|
671 |
+
"\n",
|
672 |
+
" ### Response:\n",
|
673 |
+
" 人工知能(じんこうちのう)とは、コンピューターが人間のように考えたり、学習したり、意思決定を行ったりする技術のことです。これには、機械学習やディープラーニングなどの手法が含まれます。人工知能は、医療、金融、交通などのさま\n",
|
674 |
+
"\n",
|
675 |
+
"Evaluation Metrics:\n",
|
676 |
+
"Semantic Similarity Score (Prompt to Output): 0.5944\n",
|
677 |
+
"Human-level Evaluation Scores: {'relevance': 3.43, 'fluency': 2.4, 'coherence': 4.74, 'engagement': 3.44, 'creativity': 4.9}\n"
|
678 |
+
]
|
679 |
+
}
|
680 |
+
]
|
681 |
+
},
|
682 |
+
{
|
683 |
+
"cell_type": "code",
|
684 |
+
"source": [],
|
685 |
+
"metadata": {
|
686 |
+
"id": "1VmCg7Tk20OJ"
|
687 |
+
},
|
688 |
+
"execution_count": null,
|
689 |
+
"outputs": []
|
690 |
+
}
|
691 |
+
],
|
692 |
+
"metadata": {
|
693 |
+
"accelerator": "GPU",
|
694 |
+
"colab": {
|
695 |
+
"gpuType": "A100",
|
696 |
+
"provenance": [],
|
697 |
+
"machine_shape": "hm"
|
698 |
+
},
|
699 |
+
"kernelspec": {
|
700 |
+
"display_name": "Python 3",
|
701 |
+
"name": "python3"
|
702 |
+
},
|
703 |
+
"language_info": {
|
704 |
+
"name": "python"
|
705 |
+
},
|
706 |
+
"widgets": {
|
707 |
+
"application/vnd.jupyter.widget-state+json": {
|
708 |
+
"5f8f113c31d34f6fa9330bae3ee0420b": {
|
709 |
+
"model_module": "@jupyter-widgets/controls",
|
710 |
+
"model_name": "HBoxModel",
|
711 |
+
"model_module_version": "1.5.0",
|
712 |
+
"state": {
|
713 |
+
"_dom_classes": [],
|
714 |
+
"_model_module": "@jupyter-widgets/controls",
|
715 |
+
"_model_module_version": "1.5.0",
|
716 |
+
"_model_name": "HBoxModel",
|
717 |
+
"_view_count": null,
|
718 |
+
"_view_module": "@jupyter-widgets/controls",
|
719 |
+
"_view_module_version": "1.5.0",
|
720 |
+
"_view_name": "HBoxView",
|
721 |
+
"box_style": "",
|
722 |
+
"children": [
|
723 |
+
"IPY_MODEL_f20e32c87de7433f941ff97d4d675cdb",
|
724 |
+
"IPY_MODEL_be8b969cddc0435ca085f404089f2056",
|
725 |
+
"IPY_MODEL_086b584a2b7b4ae4a86ebc7abd8ad5dc"
|
726 |
+
],
|
727 |
+
"layout": "IPY_MODEL_926eb6ec22fd498f8d7915490536eb0f"
|
728 |
+
}
|
729 |
+
},
|
730 |
+
"f20e32c87de7433f941ff97d4d675cdb": {
|
731 |
+
"model_module": "@jupyter-widgets/controls",
|
732 |
+
"model_name": "HTMLModel",
|
733 |
+
"model_module_version": "1.5.0",
|
734 |
+
"state": {
|
735 |
+
"_dom_classes": [],
|
736 |
+
"_model_module": "@jupyter-widgets/controls",
|
737 |
+
"_model_module_version": "1.5.0",
|
738 |
+
"_model_name": "HTMLModel",
|
739 |
+
"_view_count": null,
|
740 |
+
"_view_module": "@jupyter-widgets/controls",
|
741 |
+
"_view_module_version": "1.5.0",
|
742 |
+
"_view_name": "HTMLView",
|
743 |
+
"description": "",
|
744 |
+
"description_tooltip": null,
|
745 |
+
"layout": "IPY_MODEL_9aff796d690f45ebbfa03c83ac64b15d",
|
746 |
+
"placeholder": "",
|
747 |
+
"style": "IPY_MODEL_f9795627ed514b128db67a28a2127022",
|
748 |
+
"value": "Loading checkpoint shards: 100%"
|
749 |
+
}
|
750 |
+
},
|
751 |
+
"be8b969cddc0435ca085f404089f2056": {
|
752 |
+
"model_module": "@jupyter-widgets/controls",
|
753 |
+
"model_name": "FloatProgressModel",
|
754 |
+
"model_module_version": "1.5.0",
|
755 |
+
"state": {
|
756 |
+
"_dom_classes": [],
|
757 |
+
"_model_module": "@jupyter-widgets/controls",
|
758 |
+
"_model_module_version": "1.5.0",
|
759 |
+
"_model_name": "FloatProgressModel",
|
760 |
+
"_view_count": null,
|
761 |
+
"_view_module": "@jupyter-widgets/controls",
|
762 |
+
"_view_module_version": "1.5.0",
|
763 |
+
"_view_name": "ProgressView",
|
764 |
+
"bar_style": "success",
|
765 |
+
"description": "",
|
766 |
+
"description_tooltip": null,
|
767 |
+
"layout": "IPY_MODEL_7535ae64d8104d07a1659b738b0e6510",
|
768 |
+
"max": 2,
|
769 |
+
"min": 0,
|
770 |
+
"orientation": "horizontal",
|
771 |
+
"style": "IPY_MODEL_1b69fd582b1b48c0b8f15e544b28c39e",
|
772 |
+
"value": 2
|
773 |
+
}
|
774 |
+
},
|
775 |
+
"086b584a2b7b4ae4a86ebc7abd8ad5dc": {
|
776 |
+
"model_module": "@jupyter-widgets/controls",
|
777 |
+
"model_name": "HTMLModel",
|
778 |
+
"model_module_version": "1.5.0",
|
779 |
+
"state": {
|
780 |
+
"_dom_classes": [],
|
781 |
+
"_model_module": "@jupyter-widgets/controls",
|
782 |
+
"_model_module_version": "1.5.0",
|
783 |
+
"_model_name": "HTMLModel",
|
784 |
+
"_view_count": null,
|
785 |
+
"_view_module": "@jupyter-widgets/controls",
|
786 |
+
"_view_module_version": "1.5.0",
|
787 |
+
"_view_name": "HTMLView",
|
788 |
+
"description": "",
|
789 |
+
"description_tooltip": null,
|
790 |
+
"layout": "IPY_MODEL_e393fd0d6d18462580511d43f39bed59",
|
791 |
+
"placeholder": "",
|
792 |
+
"style": "IPY_MODEL_78a82107bd0b4dbfaf86255e475e9e0e",
|
793 |
+
"value": " 2/2 [00:44<00:00, 25.32s/it]"
|
794 |
+
}
|
795 |
+
},
|
796 |
+
"926eb6ec22fd498f8d7915490536eb0f": {
|
797 |
+
"model_module": "@jupyter-widgets/base",
|
798 |
+
"model_name": "LayoutModel",
|
799 |
+
"model_module_version": "1.2.0",
|
800 |
+
"state": {
|
801 |
+
"_model_module": "@jupyter-widgets/base",
|
802 |
+
"_model_module_version": "1.2.0",
|
803 |
+
"_model_name": "LayoutModel",
|
804 |
+
"_view_count": null,
|
805 |
+
"_view_module": "@jupyter-widgets/base",
|
806 |
+
"_view_module_version": "1.2.0",
|
807 |
+
"_view_name": "LayoutView",
|
808 |
+
"align_content": null,
|
809 |
+
"align_items": null,
|
810 |
+
"align_self": null,
|
811 |
+
"border": null,
|
812 |
+
"bottom": null,
|
813 |
+
"display": null,
|
814 |
+
"flex": null,
|
815 |
+
"flex_flow": null,
|
816 |
+
"grid_area": null,
|
817 |
+
"grid_auto_columns": null,
|
818 |
+
"grid_auto_flow": null,
|
819 |
+
"grid_auto_rows": null,
|
820 |
+
"grid_column": null,
|
821 |
+
"grid_gap": null,
|
822 |
+
"grid_row": null,
|
823 |
+
"grid_template_areas": null,
|
824 |
+
"grid_template_columns": null,
|
825 |
+
"grid_template_rows": null,
|
826 |
+
"height": null,
|
827 |
+
"justify_content": null,
|
828 |
+
"justify_items": null,
|
829 |
+
"left": null,
|
830 |
+
"margin": null,
|
831 |
+
"max_height": null,
|
832 |
+
"max_width": null,
|
833 |
+
"min_height": null,
|
834 |
+
"min_width": null,
|
835 |
+
"object_fit": null,
|
836 |
+
"object_position": null,
|
837 |
+
"order": null,
|
838 |
+
"overflow": null,
|
839 |
+
"overflow_x": null,
|
840 |
+
"overflow_y": null,
|
841 |
+
"padding": null,
|
842 |
+
"right": null,
|
843 |
+
"top": null,
|
844 |
+
"visibility": null,
|
845 |
+
"width": null
|
846 |
+
}
|
847 |
+
},
|
848 |
+
"9aff796d690f45ebbfa03c83ac64b15d": {
|
849 |
+
"model_module": "@jupyter-widgets/base",
|
850 |
+
"model_name": "LayoutModel",
|
851 |
+
"model_module_version": "1.2.0",
|
852 |
+
"state": {
|
853 |
+
"_model_module": "@jupyter-widgets/base",
|
854 |
+
"_model_module_version": "1.2.0",
|
855 |
+
"_model_name": "LayoutModel",
|
856 |
+
"_view_count": null,
|
857 |
+
"_view_module": "@jupyter-widgets/base",
|
858 |
+
"_view_module_version": "1.2.0",
|
859 |
+
"_view_name": "LayoutView",
|
860 |
+
"align_content": null,
|
861 |
+
"align_items": null,
|
862 |
+
"align_self": null,
|
863 |
+
"border": null,
|
864 |
+
"bottom": null,
|
865 |
+
"display": null,
|
866 |
+
"flex": null,
|
867 |
+
"flex_flow": null,
|
868 |
+
"grid_area": null,
|
869 |
+
"grid_auto_columns": null,
|
870 |
+
"grid_auto_flow": null,
|
871 |
+
"grid_auto_rows": null,
|
872 |
+
"grid_column": null,
|
873 |
+
"grid_gap": null,
|
874 |
+
"grid_row": null,
|
875 |
+
"grid_template_areas": null,
|
876 |
+
"grid_template_columns": null,
|
877 |
+
"grid_template_rows": null,
|
878 |
+
"height": null,
|
879 |
+
"justify_content": null,
|
880 |
+
"justify_items": null,
|
881 |
+
"left": null,
|
882 |
+
"margin": null,
|
883 |
+
"max_height": null,
|
884 |
+
"max_width": null,
|
885 |
+
"min_height": null,
|
886 |
+
"min_width": null,
|
887 |
+
"object_fit": null,
|
888 |
+
"object_position": null,
|
889 |
+
"order": null,
|
890 |
+
"overflow": null,
|
891 |
+
"overflow_x": null,
|
892 |
+
"overflow_y": null,
|
893 |
+
"padding": null,
|
894 |
+
"right": null,
|
895 |
+
"top": null,
|
896 |
+
"visibility": null,
|
897 |
+
"width": null
|
898 |
+
}
|
899 |
+
},
|
900 |
+
"f9795627ed514b128db67a28a2127022": {
|
901 |
+
"model_module": "@jupyter-widgets/controls",
|
902 |
+
"model_name": "DescriptionStyleModel",
|
903 |
+
"model_module_version": "1.5.0",
|
904 |
+
"state": {
|
905 |
+
"_model_module": "@jupyter-widgets/controls",
|
906 |
+
"_model_module_version": "1.5.0",
|
907 |
+
"_model_name": "DescriptionStyleModel",
|
908 |
+
"_view_count": null,
|
909 |
+
"_view_module": "@jupyter-widgets/base",
|
910 |
+
"_view_module_version": "1.2.0",
|
911 |
+
"_view_name": "StyleView",
|
912 |
+
"description_width": ""
|
913 |
+
}
|
914 |
+
},
|
915 |
+
"7535ae64d8104d07a1659b738b0e6510": {
|
916 |
+
"model_module": "@jupyter-widgets/base",
|
917 |
+
"model_name": "LayoutModel",
|
918 |
+
"model_module_version": "1.2.0",
|
919 |
+
"state": {
|
920 |
+
"_model_module": "@jupyter-widgets/base",
|
921 |
+
"_model_module_version": "1.2.0",
|
922 |
+
"_model_name": "LayoutModel",
|
923 |
+
"_view_count": null,
|
924 |
+
"_view_module": "@jupyter-widgets/base",
|
925 |
+
"_view_module_version": "1.2.0",
|
926 |
+
"_view_name": "LayoutView",
|
927 |
+
"align_content": null,
|
928 |
+
"align_items": null,
|
929 |
+
"align_self": null,
|
930 |
+
"border": null,
|
931 |
+
"bottom": null,
|
932 |
+
"display": null,
|
933 |
+
"flex": null,
|
934 |
+
"flex_flow": null,
|
935 |
+
"grid_area": null,
|
936 |
+
"grid_auto_columns": null,
|
937 |
+
"grid_auto_flow": null,
|
938 |
+
"grid_auto_rows": null,
|
939 |
+
"grid_column": null,
|
940 |
+
"grid_gap": null,
|
941 |
+
"grid_row": null,
|
942 |
+
"grid_template_areas": null,
|
943 |
+
"grid_template_columns": null,
|
944 |
+
"grid_template_rows": null,
|
945 |
+
"height": null,
|
946 |
+
"justify_content": null,
|
947 |
+
"justify_items": null,
|
948 |
+
"left": null,
|
949 |
+
"margin": null,
|
950 |
+
"max_height": null,
|
951 |
+
"max_width": null,
|
952 |
+
"min_height": null,
|
953 |
+
"min_width": null,
|
954 |
+
"object_fit": null,
|
955 |
+
"object_position": null,
|
956 |
+
"order": null,
|
957 |
+
"overflow": null,
|
958 |
+
"overflow_x": null,
|
959 |
+
"overflow_y": null,
|
960 |
+
"padding": null,
|
961 |
+
"right": null,
|
962 |
+
"top": null,
|
963 |
+
"visibility": null,
|
964 |
+
"width": null
|
965 |
+
}
|
966 |
+
},
|
967 |
+
"1b69fd582b1b48c0b8f15e544b28c39e": {
|
968 |
+
"model_module": "@jupyter-widgets/controls",
|
969 |
+
"model_name": "ProgressStyleModel",
|
970 |
+
"model_module_version": "1.5.0",
|
971 |
+
"state": {
|
972 |
+
"_model_module": "@jupyter-widgets/controls",
|
973 |
+
"_model_module_version": "1.5.0",
|
974 |
+
"_model_name": "ProgressStyleModel",
|
975 |
+
"_view_count": null,
|
976 |
+
"_view_module": "@jupyter-widgets/base",
|
977 |
+
"_view_module_version": "1.2.0",
|
978 |
+
"_view_name": "StyleView",
|
979 |
+
"bar_color": null,
|
980 |
+
"description_width": ""
|
981 |
+
}
|
982 |
+
},
|
983 |
+
"e393fd0d6d18462580511d43f39bed59": {
|
984 |
+
"model_module": "@jupyter-widgets/base",
|
985 |
+
"model_name": "LayoutModel",
|
986 |
+
"model_module_version": "1.2.0",
|
987 |
+
"state": {
|
988 |
+
"_model_module": "@jupyter-widgets/base",
|
989 |
+
"_model_module_version": "1.2.0",
|
990 |
+
"_model_name": "LayoutModel",
|
991 |
+
"_view_count": null,
|
992 |
+
"_view_module": "@jupyter-widgets/base",
|
993 |
+
"_view_module_version": "1.2.0",
|
994 |
+
"_view_name": "LayoutView",
|
995 |
+
"align_content": null,
|
996 |
+
"align_items": null,
|
997 |
+
"align_self": null,
|
998 |
+
"border": null,
|
999 |
+
"bottom": null,
|
1000 |
+
"display": null,
|
1001 |
+
"flex": null,
|
1002 |
+
"flex_flow": null,
|
1003 |
+
"grid_area": null,
|
1004 |
+
"grid_auto_columns": null,
|
1005 |
+
"grid_auto_flow": null,
|
1006 |
+
"grid_auto_rows": null,
|
1007 |
+
"grid_column": null,
|
1008 |
+
"grid_gap": null,
|
1009 |
+
"grid_row": null,
|
1010 |
+
"grid_template_areas": null,
|
1011 |
+
"grid_template_columns": null,
|
1012 |
+
"grid_template_rows": null,
|
1013 |
+
"height": null,
|
1014 |
+
"justify_content": null,
|
1015 |
+
"justify_items": null,
|
1016 |
+
"left": null,
|
1017 |
+
"margin": null,
|
1018 |
+
"max_height": null,
|
1019 |
+
"max_width": null,
|
1020 |
+
"min_height": null,
|
1021 |
+
"min_width": null,
|
1022 |
+
"object_fit": null,
|
1023 |
+
"object_position": null,
|
1024 |
+
"order": null,
|
1025 |
+
"overflow": null,
|
1026 |
+
"overflow_x": null,
|
1027 |
+
"overflow_y": null,
|
1028 |
+
"padding": null,
|
1029 |
+
"right": null,
|
1030 |
+
"top": null,
|
1031 |
+
"visibility": null,
|
1032 |
+
"width": null
|
1033 |
+
}
|
1034 |
+
},
|
1035 |
+
"78a82107bd0b4dbfaf86255e475e9e0e": {
|
1036 |
+
"model_module": "@jupyter-widgets/controls",
|
1037 |
+
"model_name": "DescriptionStyleModel",
|
1038 |
+
"model_module_version": "1.5.0",
|
1039 |
+
"state": {
|
1040 |
+
"_model_module": "@jupyter-widgets/controls",
|
1041 |
+
"_model_module_version": "1.5.0",
|
1042 |
+
"_model_name": "DescriptionStyleModel",
|
1043 |
+
"_view_count": null,
|
1044 |
+
"_view_module": "@jupyter-widgets/base",
|
1045 |
+
"_view_module_version": "1.2.0",
|
1046 |
+
"_view_name": "StyleView",
|
1047 |
+
"description_width": ""
|
1048 |
+
}
|
1049 |
+
},
|
1050 |
+
"86fa49f7dfdd42f6b2c83105e4889944": {
|
1051 |
+
"model_module": "@jupyter-widgets/controls",
|
1052 |
+
"model_name": "HBoxModel",
|
1053 |
+
"model_module_version": "1.5.0",
|
1054 |
+
"state": {
|
1055 |
+
"_dom_classes": [],
|
1056 |
+
"_model_module": "@jupyter-widgets/controls",
|
1057 |
+
"_model_module_version": "1.5.0",
|
1058 |
+
"_model_name": "HBoxModel",
|
1059 |
+
"_view_count": null,
|
1060 |
+
"_view_module": "@jupyter-widgets/controls",
|
1061 |
+
"_view_module_version": "1.5.0",
|
1062 |
+
"_view_name": "HBoxView",
|
1063 |
+
"box_style": "",
|
1064 |
+
"children": [
|
1065 |
+
"IPY_MODEL_3c20a2f65fd54b0fb75b8d3fd79cddb8",
|
1066 |
+
"IPY_MODEL_b8ad6afc290e4d2997544ba9918d0add",
|
1067 |
+
"IPY_MODEL_97df0d8e9c974748b185a3ae06251901"
|
1068 |
+
],
|
1069 |
+
"layout": "IPY_MODEL_c4c18bde61494f5ab1c7458ec5890a21"
|
1070 |
+
}
|
1071 |
+
},
|
1072 |
+
"3c20a2f65fd54b0fb75b8d3fd79cddb8": {
|
1073 |
+
"model_module": "@jupyter-widgets/controls",
|
1074 |
+
"model_name": "HTMLModel",
|
1075 |
+
"model_module_version": "1.5.0",
|
1076 |
+
"state": {
|
1077 |
+
"_dom_classes": [],
|
1078 |
+
"_model_module": "@jupyter-widgets/controls",
|
1079 |
+
"_model_module_version": "1.5.0",
|
1080 |
+
"_model_name": "HTMLModel",
|
1081 |
+
"_view_count": null,
|
1082 |
+
"_view_module": "@jupyter-widgets/controls",
|
1083 |
+
"_view_module_version": "1.5.0",
|
1084 |
+
"_view_name": "HTMLView",
|
1085 |
+
"description": "",
|
1086 |
+
"description_tooltip": null,
|
1087 |
+
"layout": "IPY_MODEL_59ad6c0427824084a5898e481afbd039",
|
1088 |
+
"placeholder": "",
|
1089 |
+
"style": "IPY_MODEL_096408b6d89f4fb3a9af0556c25845a7",
|
1090 |
+
"value": "Loading checkpoint shards: 100%"
|
1091 |
+
}
|
1092 |
+
},
|
1093 |
+
"b8ad6afc290e4d2997544ba9918d0add": {
|
1094 |
+
"model_module": "@jupyter-widgets/controls",
|
1095 |
+
"model_name": "FloatProgressModel",
|
1096 |
+
"model_module_version": "1.5.0",
|
1097 |
+
"state": {
|
1098 |
+
"_dom_classes": [],
|
1099 |
+
"_model_module": "@jupyter-widgets/controls",
|
1100 |
+
"_model_module_version": "1.5.0",
|
1101 |
+
"_model_name": "FloatProgressModel",
|
1102 |
+
"_view_count": null,
|
1103 |
+
"_view_module": "@jupyter-widgets/controls",
|
1104 |
+
"_view_module_version": "1.5.0",
|
1105 |
+
"_view_name": "ProgressView",
|
1106 |
+
"bar_style": "success",
|
1107 |
+
"description": "",
|
1108 |
+
"description_tooltip": null,
|
1109 |
+
"layout": "IPY_MODEL_e376255907964fe18cac3df52de4a8ae",
|
1110 |
+
"max": 2,
|
1111 |
+
"min": 0,
|
1112 |
+
"orientation": "horizontal",
|
1113 |
+
"style": "IPY_MODEL_34704da4553e42eda137ca9354a42545",
|
1114 |
+
"value": 2
|
1115 |
+
}
|
1116 |
+
},
|
1117 |
+
"97df0d8e9c974748b185a3ae06251901": {
|
1118 |
+
"model_module": "@jupyter-widgets/controls",
|
1119 |
+
"model_name": "HTMLModel",
|
1120 |
+
"model_module_version": "1.5.0",
|
1121 |
+
"state": {
|
1122 |
+
"_dom_classes": [],
|
1123 |
+
"_model_module": "@jupyter-widgets/controls",
|
1124 |
+
"_model_module_version": "1.5.0",
|
1125 |
+
"_model_name": "HTMLModel",
|
1126 |
+
"_view_count": null,
|
1127 |
+
"_view_module": "@jupyter-widgets/controls",
|
1128 |
+
"_view_module_version": "1.5.0",
|
1129 |
+
"_view_name": "HTMLView",
|
1130 |
+
"description": "",
|
1131 |
+
"description_tooltip": null,
|
1132 |
+
"layout": "IPY_MODEL_758165c6c34640b899ad688dfe1e31ae",
|
1133 |
+
"placeholder": "",
|
1134 |
+
"style": "IPY_MODEL_7363bab33fe94fb899195e09b88037fc",
|
1135 |
+
"value": " 2/2 [01:01<00:00, 28.97s/it]"
|
1136 |
+
}
|
1137 |
+
},
|
1138 |
+
"c4c18bde61494f5ab1c7458ec5890a21": {
|
1139 |
+
"model_module": "@jupyter-widgets/base",
|
1140 |
+
"model_name": "LayoutModel",
|
1141 |
+
"model_module_version": "1.2.0",
|
1142 |
+
"state": {
|
1143 |
+
"_model_module": "@jupyter-widgets/base",
|
1144 |
+
"_model_module_version": "1.2.0",
|
1145 |
+
"_model_name": "LayoutModel",
|
1146 |
+
"_view_count": null,
|
1147 |
+
"_view_module": "@jupyter-widgets/base",
|
1148 |
+
"_view_module_version": "1.2.0",
|
1149 |
+
"_view_name": "LayoutView",
|
1150 |
+
"align_content": null,
|
1151 |
+
"align_items": null,
|
1152 |
+
"align_self": null,
|
1153 |
+
"border": null,
|
1154 |
+
"bottom": null,
|
1155 |
+
"display": null,
|
1156 |
+
"flex": null,
|
1157 |
+
"flex_flow": null,
|
1158 |
+
"grid_area": null,
|
1159 |
+
"grid_auto_columns": null,
|
1160 |
+
"grid_auto_flow": null,
|
1161 |
+
"grid_auto_rows": null,
|
1162 |
+
"grid_column": null,
|
1163 |
+
"grid_gap": null,
|
1164 |
+
"grid_row": null,
|
1165 |
+
"grid_template_areas": null,
|
1166 |
+
"grid_template_columns": null,
|
1167 |
+
"grid_template_rows": null,
|
1168 |
+
"height": null,
|
1169 |
+
"justify_content": null,
|
1170 |
+
"justify_items": null,
|
1171 |
+
"left": null,
|
1172 |
+
"margin": null,
|
1173 |
+
"max_height": null,
|
1174 |
+
"max_width": null,
|
1175 |
+
"min_height": null,
|
1176 |
+
"min_width": null,
|
1177 |
+
"object_fit": null,
|
1178 |
+
"object_position": null,
|
1179 |
+
"order": null,
|
1180 |
+
"overflow": null,
|
1181 |
+
"overflow_x": null,
|
1182 |
+
"overflow_y": null,
|
1183 |
+
"padding": null,
|
1184 |
+
"right": null,
|
1185 |
+
"top": null,
|
1186 |
+
"visibility": null,
|
1187 |
+
"width": null
|
1188 |
+
}
|
1189 |
+
},
|
1190 |
+
"59ad6c0427824084a5898e481afbd039": {
|
1191 |
+
"model_module": "@jupyter-widgets/base",
|
1192 |
+
"model_name": "LayoutModel",
|
1193 |
+
"model_module_version": "1.2.0",
|
1194 |
+
"state": {
|
1195 |
+
"_model_module": "@jupyter-widgets/base",
|
1196 |
+
"_model_module_version": "1.2.0",
|
1197 |
+
"_model_name": "LayoutModel",
|
1198 |
+
"_view_count": null,
|
1199 |
+
"_view_module": "@jupyter-widgets/base",
|
1200 |
+
"_view_module_version": "1.2.0",
|
1201 |
+
"_view_name": "LayoutView",
|
1202 |
+
"align_content": null,
|
1203 |
+
"align_items": null,
|
1204 |
+
"align_self": null,
|
1205 |
+
"border": null,
|
1206 |
+
"bottom": null,
|
1207 |
+
"display": null,
|
1208 |
+
"flex": null,
|
1209 |
+
"flex_flow": null,
|
1210 |
+
"grid_area": null,
|
1211 |
+
"grid_auto_columns": null,
|
1212 |
+
"grid_auto_flow": null,
|
1213 |
+
"grid_auto_rows": null,
|
1214 |
+
"grid_column": null,
|
1215 |
+
"grid_gap": null,
|
1216 |
+
"grid_row": null,
|
1217 |
+
"grid_template_areas": null,
|
1218 |
+
"grid_template_columns": null,
|
1219 |
+
"grid_template_rows": null,
|
1220 |
+
"height": null,
|
1221 |
+
"justify_content": null,
|
1222 |
+
"justify_items": null,
|
1223 |
+
"left": null,
|
1224 |
+
"margin": null,
|
1225 |
+
"max_height": null,
|
1226 |
+
"max_width": null,
|
1227 |
+
"min_height": null,
|
1228 |
+
"min_width": null,
|
1229 |
+
"object_fit": null,
|
1230 |
+
"object_position": null,
|
1231 |
+
"order": null,
|
1232 |
+
"overflow": null,
|
1233 |
+
"overflow_x": null,
|
1234 |
+
"overflow_y": null,
|
1235 |
+
"padding": null,
|
1236 |
+
"right": null,
|
1237 |
+
"top": null,
|
1238 |
+
"visibility": null,
|
1239 |
+
"width": null
|
1240 |
+
}
|
1241 |
+
},
|
1242 |
+
"096408b6d89f4fb3a9af0556c25845a7": {
|
1243 |
+
"model_module": "@jupyter-widgets/controls",
|
1244 |
+
"model_name": "DescriptionStyleModel",
|
1245 |
+
"model_module_version": "1.5.0",
|
1246 |
+
"state": {
|
1247 |
+
"_model_module": "@jupyter-widgets/controls",
|
1248 |
+
"_model_module_version": "1.5.0",
|
1249 |
+
"_model_name": "DescriptionStyleModel",
|
1250 |
+
"_view_count": null,
|
1251 |
+
"_view_module": "@jupyter-widgets/base",
|
1252 |
+
"_view_module_version": "1.2.0",
|
1253 |
+
"_view_name": "StyleView",
|
1254 |
+
"description_width": ""
|
1255 |
+
}
|
1256 |
+
},
|
1257 |
+
"e376255907964fe18cac3df52de4a8ae": {
|
1258 |
+
"model_module": "@jupyter-widgets/base",
|
1259 |
+
"model_name": "LayoutModel",
|
1260 |
+
"model_module_version": "1.2.0",
|
1261 |
+
"state": {
|
1262 |
+
"_model_module": "@jupyter-widgets/base",
|
1263 |
+
"_model_module_version": "1.2.0",
|
1264 |
+
"_model_name": "LayoutModel",
|
1265 |
+
"_view_count": null,
|
1266 |
+
"_view_module": "@jupyter-widgets/base",
|
1267 |
+
"_view_module_version": "1.2.0",
|
1268 |
+
"_view_name": "LayoutView",
|
1269 |
+
"align_content": null,
|
1270 |
+
"align_items": null,
|
1271 |
+
"align_self": null,
|
1272 |
+
"border": null,
|
1273 |
+
"bottom": null,
|
1274 |
+
"display": null,
|
1275 |
+
"flex": null,
|
1276 |
+
"flex_flow": null,
|
1277 |
+
"grid_area": null,
|
1278 |
+
"grid_auto_columns": null,
|
1279 |
+
"grid_auto_flow": null,
|
1280 |
+
"grid_auto_rows": null,
|
1281 |
+
"grid_column": null,
|
1282 |
+
"grid_gap": null,
|
1283 |
+
"grid_row": null,
|
1284 |
+
"grid_template_areas": null,
|
1285 |
+
"grid_template_columns": null,
|
1286 |
+
"grid_template_rows": null,
|
1287 |
+
"height": null,
|
1288 |
+
"justify_content": null,
|
1289 |
+
"justify_items": null,
|
1290 |
+
"left": null,
|
1291 |
+
"margin": null,
|
1292 |
+
"max_height": null,
|
1293 |
+
"max_width": null,
|
1294 |
+
"min_height": null,
|
1295 |
+
"min_width": null,
|
1296 |
+
"object_fit": null,
|
1297 |
+
"object_position": null,
|
1298 |
+
"order": null,
|
1299 |
+
"overflow": null,
|
1300 |
+
"overflow_x": null,
|
1301 |
+
"overflow_y": null,
|
1302 |
+
"padding": null,
|
1303 |
+
"right": null,
|
1304 |
+
"top": null,
|
1305 |
+
"visibility": null,
|
1306 |
+
"width": null
|
1307 |
+
}
|
1308 |
+
},
|
1309 |
+
"34704da4553e42eda137ca9354a42545": {
|
1310 |
+
"model_module": "@jupyter-widgets/controls",
|
1311 |
+
"model_name": "ProgressStyleModel",
|
1312 |
+
"model_module_version": "1.5.0",
|
1313 |
+
"state": {
|
1314 |
+
"_model_module": "@jupyter-widgets/controls",
|
1315 |
+
"_model_module_version": "1.5.0",
|
1316 |
+
"_model_name": "ProgressStyleModel",
|
1317 |
+
"_view_count": null,
|
1318 |
+
"_view_module": "@jupyter-widgets/base",
|
1319 |
+
"_view_module_version": "1.2.0",
|
1320 |
+
"_view_name": "StyleView",
|
1321 |
+
"bar_color": null,
|
1322 |
+
"description_width": ""
|
1323 |
+
}
|
1324 |
+
},
|
1325 |
+
"758165c6c34640b899ad688dfe1e31ae": {
|
1326 |
+
"model_module": "@jupyter-widgets/base",
|
1327 |
+
"model_name": "LayoutModel",
|
1328 |
+
"model_module_version": "1.2.0",
|
1329 |
+
"state": {
|
1330 |
+
"_model_module": "@jupyter-widgets/base",
|
1331 |
+
"_model_module_version": "1.2.0",
|
1332 |
+
"_model_name": "LayoutModel",
|
1333 |
+
"_view_count": null,
|
1334 |
+
"_view_module": "@jupyter-widgets/base",
|
1335 |
+
"_view_module_version": "1.2.0",
|
1336 |
+
"_view_name": "LayoutView",
|
1337 |
+
"align_content": null,
|
1338 |
+
"align_items": null,
|
1339 |
+
"align_self": null,
|
1340 |
+
"border": null,
|
1341 |
+
"bottom": null,
|
1342 |
+
"display": null,
|
1343 |
+
"flex": null,
|
1344 |
+
"flex_flow": null,
|
1345 |
+
"grid_area": null,
|
1346 |
+
"grid_auto_columns": null,
|
1347 |
+
"grid_auto_flow": null,
|
1348 |
+
"grid_auto_rows": null,
|
1349 |
+
"grid_column": null,
|
1350 |
+
"grid_gap": null,
|
1351 |
+
"grid_row": null,
|
1352 |
+
"grid_template_areas": null,
|
1353 |
+
"grid_template_columns": null,
|
1354 |
+
"grid_template_rows": null,
|
1355 |
+
"height": null,
|
1356 |
+
"justify_content": null,
|
1357 |
+
"justify_items": null,
|
1358 |
+
"left": null,
|
1359 |
+
"margin": null,
|
1360 |
+
"max_height": null,
|
1361 |
+
"max_width": null,
|
1362 |
+
"min_height": null,
|
1363 |
+
"min_width": null,
|
1364 |
+
"object_fit": null,
|
1365 |
+
"object_position": null,
|
1366 |
+
"order": null,
|
1367 |
+
"overflow": null,
|
1368 |
+
"overflow_x": null,
|
1369 |
+
"overflow_y": null,
|
1370 |
+
"padding": null,
|
1371 |
+
"right": null,
|
1372 |
+
"top": null,
|
1373 |
+
"visibility": null,
|
1374 |
+
"width": null
|
1375 |
+
}
|
1376 |
+
},
|
1377 |
+
"7363bab33fe94fb899195e09b88037fc": {
|
1378 |
+
"model_module": "@jupyter-widgets/controls",
|
1379 |
+
"model_name": "DescriptionStyleModel",
|
1380 |
+
"model_module_version": "1.5.0",
|
1381 |
+
"state": {
|
1382 |
+
"_model_module": "@jupyter-widgets/controls",
|
1383 |
+
"_model_module_version": "1.5.0",
|
1384 |
+
"_model_name": "DescriptionStyleModel",
|
1385 |
+
"_view_count": null,
|
1386 |
+
"_view_module": "@jupyter-widgets/base",
|
1387 |
+
"_view_module_version": "1.2.0",
|
1388 |
+
"_view_name": "StyleView",
|
1389 |
+
"description_width": ""
|
1390 |
+
}
|
1391 |
+
}
|
1392 |
+
}
|
1393 |
+
}
|
1394 |
+
},
|
1395 |
+
"nbformat": 4,
|
1396 |
+
"nbformat_minor": 0
|
1397 |
+
}
|
eng_jap_training.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|