|
54 | 54 | "import matplotlib.pyplot as plt\n", |
55 | 55 | "import matplotlib.ticker as ticker\n", |
56 | 56 | "\n", |
57 | | - "import spacy\n", |
58 | 57 | "import numpy as np\n", |
59 | 58 | "\n", |
60 | 59 | "import random\n", |
|
116 | 115 | "metadata": {}, |
117 | 116 | "outputs": [], |
118 | 117 | "source": [ |
119 | | - "SRC = Field(tokenize = tokenize_de, \n", |
120 | | - " init_token = '<sos>', \n", |
121 | | - " eos_token = '<eos>', \n", |
122 | | - " lower = True, \n", |
123 | | - " batch_first = True)\n", |
| 118 | + "SRC = Field(tokenize=tokenize_de,\n", |
| 119 | + " init_token='<sos>',\n", |
| 120 | + " eos_token='<eos>',\n", |
| 121 | + " lower=True,\n", |
| 122 | + " batch_first=True)\n", |
124 | 123 | "\n", |
125 | | - "TRG = Field(tokenize = tokenize_en, \n", |
126 | | - " init_token = '<sos>', \n", |
127 | | - " eos_token = '<eos>', \n", |
128 | | - " lower = True, \n", |
129 | | - " batch_first = True)" |
| 124 | + "TRG = Field(tokenize=tokenize_en,\n", |
| 125 | + " init_token='<sos>',\n", |
| 126 | + " eos_token='<eos>',\n", |
| 127 | + " lower=True,\n", |
| 128 | + " batch_first=True)" |
130 | 129 | ] |
131 | 130 | }, |
132 | 131 | { |
|
142 | 141 | "metadata": {}, |
143 | 142 | "outputs": [], |
144 | 143 | "source": [ |
145 | | - "train_data, valid_data, test_data = Multi30k.splits(exts = ('.de', '.en'), \n", |
146 | | - " fields = (SRC, TRG))" |
| 144 | + "train_data, valid_data, test_data = Multi30k.splits(exts=('.de', '.en'),\n", |
| 145 | + " fields=(SRC, TRG))" |
147 | 146 | ] |
148 | 147 | }, |
149 | 148 | { |
|
169 | 168 | "metadata": {}, |
170 | 169 | "outputs": [], |
171 | 170 | "source": [ |
172 | | - "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')" |
| 171 | + "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n", |
| 172 | + "print('device:', device)" |
173 | 173 | ] |
174 | 174 | }, |
175 | 175 | { |
|
1589 | 1589 | "name": "python", |
1590 | 1590 | "nbconvert_exporter": "python", |
1591 | 1591 | "pygments_lexer": "ipython3", |
1592 | | - "version": "3.7.6" |
| 1592 | + "version": "3.6.6" |
1593 | 1593 | } |
1594 | 1594 | }, |
1595 | 1595 | "nbformat": 4, |
|
0 commit comments