Learn Before
Code
Downloading the MTFraEng Dataset
To work with the English-French translation dataset, the MTFraEng class inherits from d2l.DataModule. Its _download method retrieves the fra-eng.zip archive from a specified URL, extracts its contents, and reads the raw text file fra.txt into memory as a string.
class MTFraEng(d2l.DataModule): """The English-French dataset.""" def _download(self): d2l.extract(d2l.download( d2l.DATA_URL+'fra-eng.zip', self.root, '94646ad1522d915e7b0f9296181140edcf86a4f5')) with open(self.root + '/fra-eng/fra.txt', encoding='utf-8') as f: return f.read()
0
1
Updated 2026-05-14
Tags
D2L
Dive into Deep Learning @ D2L