├── .gitignore ├── README.md ├── Subtitle.py ├── align_script.py ├── logger.py ├── main.py ├── requirements.txt ├── static ├── running_error1.png ├── running_screenshot1.png └── running_screenshot2.png ├── test_case ├── JordanPeterson.mp4.cn.srt ├── JordanPeterson.mp4.srt ├── Lecture 1 - Introduction and Logistics.en.srt └── l1_export.srt └── translate.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | .idea/ 132 | /test_case/ 133 | /multi-sub.sh 134 | *.srt 135 | .DS_Store 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # subtitle-translator 2 | 基于 **gpt-3.5-turbo** 将 YouTube 自动生成的英文字幕、Whisper 自动识别的英文字幕或其它标准 srt 字幕文件转换为中文字幕或中英双语字幕的脚本。传统的流式音频识别会有一些突兀的事实错误,且中文实时翻译的效果更差。希望 gpt 可以通过学习上下文来避免此类错误。 3 | 4 | ### 功能说明 5 | 根据提供的字幕文件的结构选择合适的翻译策略,输出中英双语字幕或中文字幕。理论上来讲字幕文件格式越规范,GPT 的翻译效果就越好。\ 6 | 目前有逐句翻译和逐段翻译两种策略。它们是成本和效率之间的权衡。 7 | 1. 逐句翻译和普通的翻译机器没有什么区别,但是翻译质量依赖于英文字幕的质量。比如有时候英文字幕比较杂乱,句子之间没有明确的分隔,这样得到的翻译质量也不会太好,第二个缺点是句子太短,请求太快会触发 openAI 的请求上限(虽然官网标的普通用户是 20RPM,但我每隔 5秒 请求一次也会触发警告,很迷!~~刚刚绑了信用卡,等我再试试付费用户的速率~~真的很快,再也没有 Rate Limited 了!); 8 | 9 | 2. 逐段翻译可以保留上下文的信息,但是 AI 不太听话,小概率会在翻译的过程中删除句子之间的分隔符,导致我不能还原到对应的句子。第二个缺点是上下文信息太多会让 AI 把表达相近的两个句子翻译成一句话,因为英文本身就比较啰嗦,有时候会表达重复的意思。所以这里又写了一个脚本,可以在人工的基础上快速的让中文 align(其实目前没有什么好的办法更加智能,寄!)。 10 | 11 | ### 使用教程 12 | #### 获取英文字幕文件 13 | 1. 使用 [you-get](https://github.com/soimort/you-get) 下载视频,字幕会和视频一起被下载 14 | ```bash 15 | # 查看可以下载的信息,可以选择分辨率和文件等 16 | you-get -i 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 17 | # 选择一个 itag 下载 18 | you-get -itag=123 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 19 | ``` 20 | 2. 或者使用 [Whisper](https://github.com/openai/whisper) 识别本地音视频文件并输出字幕文件 21 | ```bash 22 | whisper YOUR_{VIDEO/AUDIO}_FILE --model {medium/large} --output_format srt 23 | ``` 24 | #### 设置 openAI 的 API 25 | ```bash 26 | export OPENAI_API="sk_YOUR_SECRET_KEY" 27 | ``` 28 | #### 执行脚本进行翻译,输出双语字幕文件 29 | ```bash 30 | python main.py --source_file=YOUR_SRT_FILE_PATH --target_file=OUTPUT_SRT_FILE_PATH 31 | ``` 32 | #### 运行效果 33 | 1. 在 Terminal 中执行 34 | ![execute in terminal](static/running_screenshot1.png) 35 | 36 | 2. 输出的日志文件 37 | ![logger file](static/running_screenshot2.png) 38 | 39 | GPT 感觉还是不太稳定,有时候会出现一些意想不到的错误。比如这一次的回答里出现了无关信息。感觉它的错误率在 0.1-1% 之间。 40 | ![AI error](static/running_error1.png) 41 | #### 对生成的字幕文件做校正 42 | 如果使用逐段翻译策略,很有可能最后生成的中文字幕没有对齐。打开输出的字幕文件在需要隔断的地方加“#”键,运行 align_script.py 脚本实现自动隔断。 43 | 44 | ### 结语 45 | 经过本人这几天的使用体验,我认为机器翻译仍然无法与专业的字幕组翻译相媲美,但对于日常观看的视频而言,GPT 的水平已经足够使用了。 46 | 希望这个工具能够帮助那些对其他世界感到好奇但因语言障碍而无法探索的朋友们。 47 | 也希望这个工具只是人生中的一个过渡,通过它尽早实现外语自由。 -------------------------------------------------------------------------------- /Subtitle.py: -------------------------------------------------------------------------------- 1 | from tqdm import tqdm 2 | import time 3 | 4 | from logger import logger 5 | from translate import translate_by_sentence, translate 6 | 7 | def sub_dict_init(): 8 | return {"number": None, "start_time": None, "end_time": None, "en_srt": "", "zh_srt": ""} 9 | 10 | class Subtitle: 11 | def __init__(self, file_path, style): 12 | self.file_path = file_path # 文件路径 13 | self.style = style # 字幕文件风格 14 | self.st_list = [] # 每一段字幕文本作为一个 dict 存在 list 里面 15 | self.sentence_list = [] 16 | self.segment_list = [] 17 | 18 | # read srt file 19 | with open(file_path, "r") as f: 20 | self.file_data = f.read() 21 | 22 | # transform file data to subtitle list 23 | # 针对单语字幕,且如果一条字幕有多行会被合并为一行 24 | def mono_trans(self): 25 | sub_dict_list = [] 26 | sub_dict = sub_dict_init() 27 | for i, line in enumerate(self.file_data.split("\n")): 28 | if line.isdigit(): # 字幕编号 number 29 | sub_dict['number'] = int(line) 30 | 31 | elif ' --> ' in line: # 时间点 timecode 32 | start, end = line.split(' --> ') 33 | sub_dict['start_time'] = start 34 | sub_dict['end_time'] = end 35 | 36 | elif line.strip(): # 字幕文本 subtitle text 37 | # 如果一条字幕文本换行了,则合并为一行 38 | sub_dict['en_srt'] += line + " " 39 | 40 | else: # 字幕结束,将字幕字典存储到列表中 41 | if sub_dict.get("number") is not None: 42 | sub_dict['en_srt'] = sub_dict['en_srt'].strip() # strip 后最后一个字符一定不是空格 43 | sub_dict_list.append(sub_dict) 44 | sub_dict = sub_dict_init() 45 | 46 | # 如果字幕文件来源是 youtube 那就按照它的格式解析 47 | if self.style == "youtube": 48 | sub_dict_modified = sub_dict_init() 49 | 50 | sub_dict_modified_list = [] 51 | number = 1 52 | for sub_dict in sub_dict_list: 53 | # 如果是一句话中的第一段 54 | if sub_dict_modified["number"] is None: 55 | sub_dict_modified["number"] = number 56 | number += 1 57 | sub_dict_modified["start_time"] = sub_dict["start_time"] 58 | 59 | sub_dict_modified["en_srt"] += sub_dict["en_srt"] + " " 60 | 61 | # 不管是人工制作还是机器识别的字幕,主要的目的还是将文本显示在视频上方 62 | # 所以不会遵循某种格式来制作字幕,也没有这种标准,这给字幕文件的自动化转化造成了很大的麻烦 63 | # 如何来界定一句话——为了尽量避免让 GPT 翻译没有上下文的半句话,造成翻译失真 64 | # 根据字幕文件结尾是否是 {",", ".", "?"} 判断一句话是否结束 65 | if sub_dict["en_srt"].endswith((".", "?", "!")): 66 | sub_dict_modified["end_time"] = sub_dict["end_time"] 67 | sub_dict_modified_list.append(sub_dict_modified) 68 | sub_dict_modified = sub_dict_init() 69 | continue 70 | 71 | # 由于有些字幕根本就没有标点符号,所以这里根据长度将其分割,还有什么好办法? 72 | if len(sub_dict_modified["en_srt"]) > 300: 73 | sub_dict_modified["end_time"] = sub_dict["end_time"] 74 | sub_dict_modified_list.append(sub_dict_modified) 75 | sub_dict_modified = sub_dict_init() 76 | continue 77 | 78 | return sub_dict_modified_list 79 | 80 | return sub_dict_list 81 | 82 | # 导出单/双语言字幕文件 83 | def export_srt(self, target_path): 84 | with open(target_path, 'w') as file: 85 | for sub in self.st_list: 86 | file.write(str(sub['number']) + '\n') 87 | file.write(sub['start_time'] + ' --> ' + sub['end_time'] + '\n') 88 | file.write(sub['en_srt'] + '\n') 89 | if sub['zh_srt'] != "": 90 | file.write(sub['zh_srt'] + '\n') 91 | file.write('\n') 92 | 93 | logger.info("export to srt file successfully!") 94 | 95 | def get_segment_list(self): 96 | # 把每一段都存储到一个列表,段的划分受限于 tokens 的大小,段落越长,机器的上下文理解力就越好,但越容易超出限制。 97 | text = "" 98 | seg_start = 1 99 | for i, st in enumerate(self.st_list): 100 | text += st["en_srt"] + "#" 101 | if len(text) > 1500: 102 | self.segment_list.append({ 103 | "start": seg_start, 104 | "end": i+1, 105 | "length": i+1-seg_start, 106 | "text": text[:-1] 107 | }) 108 | seg_start = i+2 109 | text = "" 110 | # 将最后一个不足长度的 segment 添加到 segment_list 111 | self.segment_list.append({ 112 | "start": seg_start, 113 | "end": len(self.st_list)+1, 114 | "length": len(self.st_list)+1-seg_start, 115 | "text": text[:-1] 116 | }) 117 | 118 | def translate(self, policy): 119 | if policy == 0: 120 | # 逐句翻译 121 | for i in tqdm(range(len(self.st_list)), desc="Processing", ncols=80, leave=True): 122 | self.st_list[i]["zh_srt"] = translate_by_sentence(self.st_list[i]["en_srt"]) 123 | 124 | elif policy == 1: 125 | # 逐段翻译 126 | self.get_segment_list() 127 | # 把 segment 分批翻译,并按句子划分存到 sentence_list 128 | for i in tqdm(range(len(self.segment_list)), desc="Processing", ncols=80, leave=True): 129 | seg = self.segment_list[i] 130 | res = translate(seg["text"]) 131 | 132 | sentence_list = res.split("#") 133 | if seg["length"] == len(sentence_list): # 完美结果 134 | self.sentence_list += sentence_list 135 | logger.info("完美分割") 136 | 137 | elif seg["length"] > len(sentence_list): # 有些句子没有分开 138 | self.sentence_list += sentence_list 139 | logger.warning( 140 | f"第 {seg['start']} - {seg['end']} 号的句子没有分开,有 {seg['length'] - len(sentence_list)} 行unaligned") 141 | 142 | else: # 奇怪的错误 143 | logger.error("奇怪的错误") 144 | 145 | for i, sub in enumerate(self.st_list): 146 | if i < len(self.sentence_list): 147 | sub["zh_srt"] = self.sentence_list[i] 148 | else: 149 | break 150 | 151 | def statis(self): 152 | en_statis = [len(sub["en_srt"]) for sub in self.st_list] 153 | zh_statis = [len(sub["zh_srt"]) for sub in self.st_list] 154 | 155 | en_statis_max, en_statis_min, en_statis_mean = max(en_statis), min(en_statis), sum(en_statis) / len(en_statis) 156 | zh_statis_max, zh_statis_min, zh_statis_mean = max(zh_statis), min(zh_statis), sum(zh_statis) / len(zh_statis) 157 | 158 | logger.info(f"英文字幕最大长度: {en_statis_max}\n英文字幕最短长度: {en_statis_min}\n英文字幕平均长度: {en_statis_mean}") 159 | logger.info(f"中文字幕最大长度: {zh_statis_max}\n中文字幕最短长度: {zh_statis_min}\n中文字幕平均长度: {zh_statis_mean}") 160 | 161 | if __name__ == "__main__": 162 | # 1. 初始化 读取 srt 文件 163 | subtitle = Subtitle(file_path="test_case/Lecture 1 - Introduction and Logistics.en.srt", style="youtube") 164 | # 2. 根据不同的字幕风格转导为相应的字幕格式 165 | subtitle.st_list = subtitle.mono_trans() 166 | # 3. 翻译 167 | #subtitle.translate(policy=0) 168 | # 导出为双语字幕文件 169 | #subtitle.export_srt("test_case/l1_export.srt") 170 | -------------------------------------------------------------------------------- /align_script.py: -------------------------------------------------------------------------------- 1 | with open("test_case/output.srt", "r") as f: 2 | file_data = f.read() 3 | 4 | sub_dict_list = [] 5 | sub_dict = { 6 | "number": None, 7 | "start_time": None, 8 | "end_time": None, 9 | "en_srt": "", 10 | "zh_srt": "" 11 | } 12 | for i, line in enumerate(file_data.split("\n")): 13 | if line.isdigit(): # 字幕编号 14 | sub_dict['number'] = int(line) 15 | 16 | elif ' --> ' in line: # 时间戳 17 | start, end = line.split(' --> ') 18 | sub_dict['start_time'] = start 19 | sub_dict['end_time'] = end 20 | 21 | elif "." in line.strip(): # 英文字幕内容 22 | sub_dict['en_srt'] = line.strip() 23 | 24 | elif "。" in line.strip(): # 中文字幕内容 25 | sub_dict["zh_srt"] = line.strip() 26 | 27 | else: # 字幕结束,将字幕字典存储到列表中 28 | if sub_dict.get("number") is not None: 29 | sub_dict_list.append(sub_dict) 30 | sub_dict = { 31 | "number": None, 32 | "start_time": None, 33 | "end_time": None, 34 | "en_srt": "", 35 | "zh_srt": "" 36 | } 37 | 38 | for i in range(len(sub_dict_list)): 39 | if "#" in sub_dict_list[i]["zh_srt"]: 40 | 41 | split_item = sub_dict_list[i]["zh_srt"].split("#") 42 | for j in range(len(sub_dict_list)-1, i, -1): 43 | sub_dict_list[j]["zh_srt"] = sub_dict_list[j-1]["zh_srt"] 44 | sub_dict_list[i]["zh_srt"] = split_item[0] 45 | sub_dict_list[i+1]["zh_srt"] = split_item[1] 46 | 47 | with open("test_case/output.srt", 'w') as file: 48 | for sub in sub_dict_list: 49 | file.write(str(sub['number']) + '\n') 50 | file.write(sub['start_time'] + ' --> ' + sub['end_time'] + '\n') 51 | file.write(sub['en_srt'] + '\n') 52 | if sub['zh_srt'] != "": 53 | file.write(sub['zh_srt'] + '\n') 54 | file.write('\n') 55 | -------------------------------------------------------------------------------- /logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logger = logging.getLogger("main") 4 | logger.setLevel(logging.DEBUG) 5 | formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%H:%M:%S') 6 | 7 | fh = logging.FileHandler('output.log') 8 | fh.setLevel(logging.INFO) 9 | fh.setFormatter(formatter) 10 | 11 | logger.addHandler(fh) 12 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | from Subtitle import Subtitle 3 | 4 | def run(source_file, source_style, target_file, translate_policy, log_dir): 5 | # 导入字幕文件 6 | sub_source = Subtitle(file_path=source_file, style=source_style) 7 | # 转换字幕文件风格 8 | sub_source.st_list = sub_source.mono_trans() 9 | # 字幕文件翻译 10 | sub_source.translate(policy=translate_policy) 11 | # 生成结果统计 12 | sub_source.statis() 13 | # 导出为双语字幕文件 14 | sub_source.export_srt(target_file) 15 | 16 | def parse_opt(): 17 | parser = argparse.ArgumentParser() 18 | parser.add_argument('--source_file', type=str, help='srt file path') 19 | parser.add_argument('--source_style', type=str, default="youtube", help='reshape sub with specified style') 20 | parser.add_argument('--target_file', type=str, default="output.srt", help='srt file export path') 21 | parser.add_argument('--translate_policy', type=int, default=0, help='srt file export path') 22 | parser.add_argument('--log_dir', type=str, default="output.log", help='log file path') 23 | opt = parser.parse_args() 24 | return opt 25 | 26 | def main(opt): 27 | run(**vars(opt)) 28 | 29 | if __name__ == "__main__": 30 | opt = parse_opt() 31 | main(opt) 32 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.8.4 2 | aiosignal==1.3.1 3 | async-timeout==4.0.2 4 | attrs==22.2.0 5 | certifi==2022.12.7 6 | charset-normalizer==3.1.0 7 | frozenlist==1.3.3 8 | idna==3.4 9 | multidict==6.0.4 10 | openai==0.27.0 11 | requests==2.28.2 12 | tqdm==4.65.0 13 | urllib3==1.26.14 14 | yarl==1.8.2 15 | -------------------------------------------------------------------------------- /static/running_error1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fanxing333/subtitle-translator/b0fc3d7966ff314936a48a991c267909c7811317/static/running_error1.png -------------------------------------------------------------------------------- /static/running_screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fanxing333/subtitle-translator/b0fc3d7966ff314936a48a991c267909c7811317/static/running_screenshot1.png -------------------------------------------------------------------------------- /static/running_screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fanxing333/subtitle-translator/b0fc3d7966ff314936a48a991c267909c7811317/static/running_screenshot2.png -------------------------------------------------------------------------------- /test_case/JordanPeterson.mp4.cn.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,000 --> 00:00:17,000 3 | Is that sufficient? But you do have certain predispositions that you're giving in the same way in which people from political correctness are trying to say, this is what it means to be a woman, these are the kind of things that it is expected from a woman to do to defend herself. 4 | 这样就足够了吗?但是你确实有某些倾向,就像政治正确的人们试图说,这就是作为一个女人的意义,这些是期望女人为了自卫而做的事情。 5 | 6 | 2 7 | 00:00:17,000 --> 00:00:25,000 8 | And it seems to me that you are making a similar claim about, this is what conservative people do, and this is how they always relate to hierarchy. 9 | 而且在我看来,你似乎在提出一个类似的主张,即保守派人士的做法是这样的,他们总是与等级制度相关。 10 | 11 | 3 12 | 00:00:25,000 --> 00:00:35,000 13 | Well, I would say that I perhaps am doing that, but I don't see how that's the same as what the postmodernists are doing. 14 | 嗯,我会说我可能正在做那件事,但我不明白那和后现代主义者所做的是一样的。 15 | 16 | 4 17 | 00:00:35,000 --> 00:00:48,000 18 | I mean, as far as I can tell, the postmodernists aren't saying that the groups, the individuals within those groups, are characterized by any stable characteristics whatsoever, except for the fact of their comparative oppression. 19 | 我的意思是,就我所知,后现代主义者并没有说这些群体中的个人具有任何稳定的特征,除了他们相对压迫的事实。 20 | 21 | 5 22 | 00:00:48,000 --> 00:00:51,000 23 | So I don't understand the first part of your argument. 24 | 所以我不理解你论点的第一部分。 25 | 26 | 6 27 | 00:00:51,000 --> 00:00:57,000 28 | I mean, part of the reason the postmodern types have been going after me is because I've dared to say that men and women differ in temperament. 29 | 我的意思是,后现代主义者攻击我部分原因是因为我敢于说男人和女人在性情上有所不同。 30 | 31 | 7 32 | 00:00:57,000 --> 00:01:00,000 33 | Which, by the way, they do. 34 | 顺便说一句,他们确实这样做。 35 | 36 | 8 37 | 00:01:00,000 --> 00:01:17,000 38 | Now, you know, that's actually something that might be worth just differentiating quickly, because it's actually technically somewhat challenging, but also very much worth knowing. 39 | 现在,你知道,这实际上可能值得快速区分,因为它在技术上有些具有挑战性,但也非常值得知道。 40 | 41 | 9 42 | 00:01:17,000 --> 00:01:38,000 43 | I was debating someone on a panel this morning on a TV show, The Right Stuff, and this was a woman who led the women's equality party, and she cited some psychological literature that purported to claim that men and women were mostly the same. 44 | 今天早上我在电视节目《正确的事情》上与一个小组中的某人进行辩论,这是一位领导妇女平等党的女性,她引用了一些心理学文献,声称男性和女性大多相同。 45 | 46 | 10 47 | 00:01:38,000 --> 00:01:41,000 48 | And that's actually true. 49 | 那其实是真的。 50 | 51 | 11 52 | 00:01:41,000 --> 00:01:43,000 53 | We are more the same than different. 54 | 我们更相似,而不是不同。 55 | 56 | 12 57 | 00:01:43,000 --> 00:01:49,000 58 | If you look at our temperaments, there's more overlap than there is variance by a substantial amount. 59 | 如果你看看我们的性情,重叠的部分比差异要多得多。 60 | 61 | 13 62 | 00:01:49,000 --> 00:01:58,000 63 | And so even on the temperamental dimensions where there is most difference between men and women, the difference isn't of massive magnitude at the center of the distribution. 64 | 因此,即使在男性和女性之间存在最大差异的情绪维度上,差异在分布的中心也不是非常巨大。 65 | 66 | 14 67 | 00:01:58,000 --> 00:02:08,000 68 | So, for example, women are less aggressive than men, which is, by the way, why they try to commit suicide more often, but are much less lethal in their actions. 69 | 例如,女性比男性更少有攻击性,这也是为什么她们更经常尝试自杀,但她们的行动却远不如男性致命。 70 | 71 | 15 72 | 00:02:08,000 --> 00:02:11,000 73 | That's one example, but there are many examples. 74 | 那只是一个例子,但还有很多例子。 75 | 76 | 16 77 | 00:02:11,000 --> 00:02:18,000 78 | If you draw a random woman and a random man out of the population, the probability that the man will be more aggressive is 60%. 79 | 如果你从人群中随机抽取一名女性和一名男性,那么男性更具攻击性的概率为60%。 80 | 81 | 17 82 | 00:02:18,000 --> 00:02:20,000 83 | If you bet on the man, you'd win 60% of the time. 84 | 如果你押这个人赢,你会赢60%的时间。 85 | 86 | 18 87 | 00:02:20,000 --> 00:02:22,000 88 | That's not a walloping difference. 89 | 那不是一个很大的差别。 90 | 91 | 19 92 | 00:02:22,000 --> 00:02:24,000 93 | It's not 95% of the time. 94 | 它不是95%的时间。 95 | 96 | 20 97 | 00:02:24,000 --> 00:02:28,000 98 | You know, it's a difference that is substantive. 99 | 你知道,这是一个实质性的差别。 100 | 101 | 21 102 | 00:02:28,000 --> 00:02:31,000 103 | It's significant. It's measurable. 104 | 这很重要。这是可以衡量的。 105 | 106 | 22 107 | 00:02:31,000 --> 00:02:35,000 108 | But it's not large by the standards by which such things are judged. 109 | 但按照这类事物的标准来衡量,它并不算大。 110 | 111 | 23 112 | 00:02:35,000 --> 00:02:37,000 113 | But that's not the point. 114 | 但这不是重点。 115 | 116 | 24 117 | 00:02:37,000 --> 00:02:42,000 118 | The point is that most of the activity takes place at the extremes. 119 | 重点是大部分活动发生在极端情况下。 120 | 121 | 25 122 | 00:02:42,000 --> 00:02:44,000 123 | So out on the tails of the distribution. 124 | 在分布的尾部。 125 | 126 | 26 127 | 00:02:44,000 --> 00:02:46,000 128 | So here's an example. 129 | 所以这里有一个例子。 130 | 131 | 27 132 | 00:02:46,000 --> 00:02:49,000 133 | About 9 out of 10 people in prison are male. 134 | 大约有10个犯人中有9个是男性。 135 | 136 | 28 137 | 00:02:49,000 --> 00:02:57,000 138 | Why? Because to be in prison, you have to be the most aggressive person, let's say, in 100. 139 | 为什么?因为要进监狱,你必须是100个人中最具攻击性的人。 140 | 141 | 29 142 | 00:02:57,000 --> 00:02:59,000 143 | Okay. 144 | 好的。 145 | 146 | 30 147 | 00:02:59,000 --> 00:03:08,000 148 | Those differences at the midpoint are large enough so that if you go out to the extremes, 1 in 100 people, you have an overwhelming preponderance of men. 149 | 中间点处的差异足够大,以至于如果你走到极端,即100个人中的1个人,你会发现男性占压倒性优势。 150 | 151 | 31 152 | 00:03:08,000 --> 00:03:10,000 153 | And so you can have your cake and eat it too. 154 | 所以你可以拥有你的蛋糕并且吃掉它。 155 | 156 | 32 157 | 00:03:10,000 --> 00:03:14,000 158 | You can say, well, yeah, broadly speaking, men and women are more the same than different. 159 | 你可以说,广义上来讲,男性和女性更相似而非不同。 160 | 161 | 33 162 | 00:03:14,000 --> 00:03:18,000 163 | The overlap is greater than the disjunction. 164 | 重叠部分大于分离部分。 165 | 166 | 34 167 | 00:03:18,000 --> 00:03:23,000 168 | But that's not relevant if what's being selected is often at the extremes. 169 | 但如果被选择的东西经常处于极端状态,那么这就不相关了。 170 | 171 | 35 172 | 00:03:23,000 --> 00:03:24,000 173 | And it often is. 174 | 它经常是这样的。 175 | 176 | 36 177 | 00:03:24,000 --> 00:03:33,000 178 | So, for example, with regards to engineering, there's a fair bit of evidence that people who are more interested in things than in people become engineers. 179 | 因此,例如在工程方面,有相当多的证据表明,对事物比对人更感兴趣的人会成为工程师。 180 | 181 | 37 182 | 00:03:33,000 --> 00:03:44,000 183 | Now, that's not really going to be, what is that, shocking? Are you shocked by that? You shouldn't be shocked by that, right? You can tell that not only by what engineers do, but you can tell that by how they think. 184 | 现在,这不会真的是什么,那是什么,令人震惊吗?你被这个震惊了吗?你不应该被这个震惊,对吧?你可以通过工程师的行为和思考方式来看出这一点。 185 | 186 | 38 187 | 00:03:44,000 --> 00:03:49,000 188 | And you can tell that just by talking to them, if you know a bunch of engineers. 189 | 如果你认识一群工程师,通过和他们交谈,你就能感觉出来。 190 | 191 | 39 192 | 00:03:49,000 --> 00:03:58,000 193 | So, and it turns out that the largest temperamental difference that's known between men and women is actually interest in people versus interest in things. 194 | 因此,事实证明男女之间已知的最大性情差异实际上是对人或对事物的兴趣。 195 | 196 | 40 197 | 00:03:58,000 --> 00:04:02,000 198 | And so it has nothing to do with competence, but it has a lot to do with interest. 199 | 因此,这与能力无关,但与兴趣有很大关系。 200 | 201 | 41 202 | 00:04:02,000 --> 00:04:14,000 203 | And because you have to be very interested in things to go be an engineer, because that's all you're going to be doing if you're an engineer, then only those people who are extremely interested in things tend to become engineers. 204 | 因为你必须对事物非常感兴趣才能成为一名工程师,因为如果你是一名工程师,那么你所做的就是这些事情,所以只有那些对事物非常感兴趣的人才会成为工程师。 205 | 206 | 42 207 | 00:04:14,000 --> 00:04:15,000 208 | And most of them are men. 209 | 他们中的大多数是男性。 210 | 211 | 43 212 | 00:04:15,000 --> 00:04:29,000 213 | And that's why even in places like Scandinavia, where a tremendous amount of effort has been put into flattening the sociocultural landscape, successfully, by the way, there's still a preponderance of male engineers. 214 | 这就是为什么即使在像斯堪的纳维亚这样的地方,已经投入了大量的努力来成功地平衡社会文化景观,仍然有大量男性工程师的原因。 215 | 216 | 44 217 | 00:04:29,000 --> 00:04:32,000 218 | And there's a preponderance of female nurses. 219 | 有大量女性护士。 220 | 221 | 45 222 | 00:04:32,000 --> 00:04:43,000 223 | And no matter how much sociological gerrymandering goes on, those statistics have remained quite intractable over about a 15-year period. 224 | 无论进行多少社会学的选区划分,这些统计数据在约15年的时间内仍然非常棘手。 225 | 226 | 46 227 | 00:04:43,000 --> 00:04:45,000 228 | And so there are differences. 229 | 因此存在差异。 230 | 231 | 47 232 | 00:04:45,000 --> 00:04:46,000 233 | There are differences. 234 | 有差异。 235 | 236 | 48 237 | 00:04:46,000 --> 00:04:48,000 238 | They're not massive. 239 | 它们不是巨大的。 240 | 241 | 49 242 | 00:04:48,000 --> 00:05:06,000 243 | And then you might ask, well, are those sociocultural or biological? It's like, well, that's a hard question to answer because it depends on how much variability there is in the sociocultural landscape because the proportion by which something is biological versus sociocultural varies with the sociocultural landscape. 244 | 然后你可能会问,那这些是社会文化因素还是生物因素引起的呢?这是一个难以回答的问题,因为它取决于社会文化环境中的变异程度,因为某种事物是生物因素还是社会文化因素所占比例,取决于社会文化环境的变化。 245 | 246 | 50 247 | 00:05:06,000 --> 00:05:12,000 248 | That's a complicated thing to digest because you think of those things as fixed, but they're not. 249 | 这是一件复杂的事情需要消化,因为你认为这些事情是固定的,但实际上它们并不是固定的。 250 | 251 | 51 252 | 00:05:12,000 --> 00:05:24,000 253 | But what we have demonstrated quite clearly, and this is mainstream science despite the fact that people don't like it, this test has already been done. 254 | 但是我们已经非常清楚地证明了,尽管人们不喜欢它,这是主流科学,这个测试已经完成了。 255 | 256 | 52 257 | 00:05:24,000 --> 00:05:37,000 258 | So we developed a personality model that's pretty stable across cultures, purely derived from statistical processes, an atheoretical model if there ever was one, and quite an unattractive model because of that conceptually. 259 | 因此,我们开发了一个人格模型,它在不同文化中非常稳定,纯粹基于统计过程推导而来,如果有的话,这是一个无神论的模型,概念上相当不吸引人。 260 | 261 | 53 262 | 00:05:37,000 --> 00:05:38,000 263 | But that's beside the point. 264 | 但那不是重点。 265 | 266 | 54 267 | 00:05:38,000 --> 00:05:43,000 268 | Then we saw cross-culturally whether there were differences in the fundamental temperaments of men and women. 269 | 然后我们跨文化地观察男女的基本气质是否存在差异。 270 | 271 | 55 272 | 00:05:43,000 --> 00:05:46,000 273 | And the answer was yes, cross-culturally, quite robust. 274 | 答案是肯定的,跨文化的影响力也非常强大。 275 | 276 | 56 277 | 00:05:46,000 --> 00:05:51,000 278 | Women are higher in the experience of anxiety and emotional pain, and they're more compassionate and agreeable. 279 | 女性在焦虑和情感痛苦方面的经验更丰富,她们更有同情心和易相处。 280 | 281 | 57 282 | 00:05:51,000 --> 00:05:53,000 283 | Those are the big differences. 284 | 那些是很大的不同之处。 285 | 286 | 58 287 | 00:05:53,000 --> 00:05:56,000 288 | And they're differences of a magnitude that I already pointed out. 289 | 它们的差异已经是我指出的那个级别。 290 | 291 | 59 292 | 00:05:56,000 --> 00:06:08,000 293 | Then the next question is, well, to what degree is that biological versus sociocultural? And it's complicated because that variable depends on the sociocultural landscape, but we'll put that aside. 294 | 那么下一个问题是,这种差异在多大程度上是生物学因素和社会文化因素的影响?这很复杂,因为这个变量取决于社会文化环境,但我们暂且不考虑这个因素。 295 | 296 | 60 297 | 00:06:08,000 --> 00:06:23,000 298 | You can determine that by stacking up countries from those who have done everything they possibly can to flatten out the sociocultural landscape in relationship to gender to those who haven't, that are still very stratified by sex. 299 | 你可以通过将国家按照在性别方面尽可能平衡社会文化景观和那些仍然非常性别分层的国家进行堆叠来确定这一点。 300 | 301 | 61 302 | 00:06:23,000 --> 00:06:35,000 303 | And then what you do is you look at the magnitude of the temperament differences in keeping with the variability that those countries have in terms of their sociocultural egalitarianism. 304 | 然后你要做的是,根据这些国家在社会文化平等方面的变异性,观察气质差异的大小。 305 | 306 | 62 307 | 00:06:35,000 --> 00:06:47,000 308 | And the sociocultural types, the social constructionists, their prediction is as cultures become more egalitarian, men and women become more different, more the same. 309 | 社会文化类型,社会建构主义者预测随着文化变得更加平等,男女之间会变得更加不同,或者更加相似。 310 | 311 | 63 312 | 00:06:47,000 --> 00:06:50,000 313 | Sorry, more the same, because it's environmental. 314 | 抱歉,这是因为环保的原因,所以会有更多相同的东西。 315 | 316 | 64 317 | 00:06:50,000 --> 00:06:52,000 318 | That isn't what happens. 319 | 那不是发生的事情。 320 | 321 | 65 322 | 00:06:52,000 --> 00:06:54,000 323 | Exactly the opposite happens. 324 | 恰恰相反。 325 | 326 | 66 327 | 00:06:54,000 --> 00:07:00,000 328 | As you flatten out the sociocultural landscape, men and women become more different. 329 | 当你抹平社会文化的景观时,男性和女性变得更加不同。 330 | 331 | 67 332 | 00:07:00,000 --> 00:07:02,000 333 | The data is in. 334 | 数据已经出来了。 335 | 336 | 68 337 | 00:07:02,000 --> 00:07:04,000 338 | The experiment is done. 339 | 实验已经完成。 340 | 341 | 69 342 | 00:07:04,000 --> 00:07:07,000 343 | Tens of thousands of people, multiple countries. 344 | 数万人,多个国家。 345 | 346 | 70 347 | 00:07:07,000 --> 00:07:09,000 348 | And it's not what anyone expected. 349 | 这不是任何人预料到的。 350 | 351 | 71 352 | 00:07:09,000 --> 00:07:12,000 353 | And you might think, well, it's all the right-wing psychologists. 354 | 你可能会认为,这都是右翼心理学家的错。 355 | 356 | 72 357 | 00:07:12,000 --> 00:07:41,000 358 | It's like all the right-wing psychologists are in this room, sitting in this chair. 359 | 就好像所有右翼的心理学家都在这个房间里,坐在这把椅子上。 360 | 361 | -------------------------------------------------------------------------------- /test_case/JordanPeterson.mp4.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,000 --> 00:00:04,000 3 | Is that sufficient? 4 | 5 | 2 6 | 00:00:04,000 --> 00:00:12,000 7 | But you do have certain predispositions that you're giving in the same way in which people from political correctness are trying to say, 8 | 9 | 3 10 | 00:00:12,000 --> 00:00:17,000 11 | this is what it means to be a woman, these are the kind of things that it is expected from a woman to do to defend herself. 12 | 13 | 4 14 | 00:00:17,000 --> 00:00:25,000 15 | And it seems to me that you are making a similar claim about, this is what conservative people do, and this is how they always relate to hierarchy. 16 | 17 | 5 18 | 00:00:25,000 --> 00:00:35,000 19 | Well, I would say that I perhaps am doing that, but I don't see how that's the same as what the postmodernists are doing. 20 | 21 | 6 22 | 00:00:35,000 --> 00:00:42,000 23 | I mean, as far as I can tell, the postmodernists aren't saying that the groups, the individuals within those groups, 24 | 25 | 7 26 | 00:00:42,000 --> 00:00:48,000 27 | are characterized by any stable characteristics whatsoever, except for the fact of their comparative oppression. 28 | 29 | 8 30 | 00:00:48,000 --> 00:00:51,000 31 | So I don't understand the first part of your argument. 32 | 33 | 9 34 | 00:00:51,000 --> 00:00:57,000 35 | I mean, part of the reason the postmodern types have been going after me is because I've dared to say that men and women differ in temperament. 36 | 37 | 10 38 | 00:00:57,000 --> 00:01:00,000 39 | Which, by the way, they do. 40 | 41 | 11 42 | 00:01:00,000 --> 00:01:11,000 43 | Now, you know, that's actually something that might be worth just differentiating quickly, 44 | 45 | 12 46 | 00:01:11,000 --> 00:01:17,000 47 | because it's actually technically somewhat challenging, but also very much worth knowing. 48 | 49 | 13 50 | 00:01:17,000 --> 00:01:25,000 51 | I was debating someone on a panel this morning on a TV show, The Right Stuff, 52 | 53 | 14 54 | 00:01:25,000 --> 00:01:31,000 55 | and this was a woman who led the women's equality party, 56 | 57 | 15 58 | 00:01:31,000 --> 00:01:38,000 59 | and she cited some psychological literature that purported to claim that men and women were mostly the same. 60 | 61 | 16 62 | 00:01:38,000 --> 00:01:41,000 63 | And that's actually true. 64 | 65 | 17 66 | 00:01:41,000 --> 00:01:43,000 67 | We are more the same than different. 68 | 69 | 18 70 | 00:01:43,000 --> 00:01:49,000 71 | If you look at our temperaments, there's more overlap than there is variance by a substantial amount. 72 | 73 | 19 74 | 00:01:49,000 --> 00:01:54,000 75 | And so even on the temperamental dimensions where there is most difference between men and women, 76 | 77 | 20 78 | 00:01:54,000 --> 00:01:58,000 79 | the difference isn't of massive magnitude at the center of the distribution. 80 | 81 | 21 82 | 00:01:58,000 --> 00:02:05,000 83 | So, for example, women are less aggressive than men, which is, by the way, why they try to commit suicide more often, 84 | 85 | 22 86 | 00:02:05,000 --> 00:02:08,000 87 | but are much less lethal in their actions. 88 | 89 | 23 90 | 00:02:08,000 --> 00:02:11,000 91 | That's one example, but there are many examples. 92 | 93 | 24 94 | 00:02:11,000 --> 00:02:14,000 95 | If you draw a random woman and a random man out of the population, 96 | 97 | 25 98 | 00:02:14,000 --> 00:02:18,000 99 | the probability that the man will be more aggressive is 60%. 100 | 101 | 26 102 | 00:02:18,000 --> 00:02:20,000 103 | If you bet on the man, you'd win 60% of the time. 104 | 105 | 27 106 | 00:02:20,000 --> 00:02:22,000 107 | That's not a walloping difference. 108 | 109 | 28 110 | 00:02:22,000 --> 00:02:24,000 111 | It's not 95% of the time. 112 | 113 | 29 114 | 00:02:24,000 --> 00:02:28,000 115 | You know, it's a difference that is substantive. 116 | 117 | 30 118 | 00:02:28,000 --> 00:02:31,000 119 | It's significant. It's measurable. 120 | 121 | 31 122 | 00:02:31,000 --> 00:02:35,000 123 | But it's not large by the standards by which such things are judged. 124 | 125 | 32 126 | 00:02:35,000 --> 00:02:37,000 127 | But that's not the point. 128 | 129 | 33 130 | 00:02:37,000 --> 00:02:42,000 131 | The point is that most of the activity takes place at the extremes. 132 | 133 | 34 134 | 00:02:42,000 --> 00:02:44,000 135 | So out on the tails of the distribution. 136 | 137 | 35 138 | 00:02:44,000 --> 00:02:46,000 139 | So here's an example. 140 | 141 | 36 142 | 00:02:46,000 --> 00:02:49,000 143 | About 9 out of 10 people in prison are male. 144 | 145 | 37 146 | 00:02:49,000 --> 00:02:51,000 147 | Why? 148 | 149 | 38 150 | 00:02:51,000 --> 00:02:57,000 151 | Because to be in prison, you have to be the most aggressive person, let's say, in 100. 152 | 153 | 39 154 | 00:02:57,000 --> 00:02:59,000 155 | Okay. 156 | 157 | 40 158 | 00:02:59,000 --> 00:03:03,000 159 | Those differences at the midpoint are large enough so that if you go out to the extremes, 160 | 161 | 41 162 | 00:03:03,000 --> 00:03:08,000 163 | 1 in 100 people, you have an overwhelming preponderance of men. 164 | 165 | 42 166 | 00:03:08,000 --> 00:03:10,000 167 | And so you can have your cake and eat it too. 168 | 169 | 43 170 | 00:03:10,000 --> 00:03:14,000 171 | You can say, well, yeah, broadly speaking, men and women are more the same than different. 172 | 173 | 44 174 | 00:03:14,000 --> 00:03:18,000 175 | The overlap is greater than the disjunction. 176 | 177 | 45 178 | 00:03:18,000 --> 00:03:23,000 179 | But that's not relevant if what's being selected is often at the extremes. 180 | 181 | 46 182 | 00:03:23,000 --> 00:03:24,000 183 | And it often is. 184 | 185 | 47 186 | 00:03:24,000 --> 00:03:27,000 187 | So, for example, with regards to engineering, 188 | 189 | 48 190 | 00:03:27,000 --> 00:03:33,000 191 | there's a fair bit of evidence that people who are more interested in things than in people become engineers. 192 | 193 | 49 194 | 00:03:33,000 --> 00:03:36,000 195 | Now, that's not really going to be, what is that, shocking? 196 | 197 | 50 198 | 00:03:36,000 --> 00:03:37,000 199 | Are you shocked by that? 200 | 201 | 51 202 | 00:03:37,000 --> 00:03:39,000 203 | You shouldn't be shocked by that, right? 204 | 205 | 52 206 | 00:03:39,000 --> 00:03:44,000 207 | You can tell that not only by what engineers do, but you can tell that by how they think. 208 | 209 | 53 210 | 00:03:44,000 --> 00:03:49,000 211 | And you can tell that just by talking to them, if you know a bunch of engineers. 212 | 213 | 54 214 | 00:03:49,000 --> 00:03:55,000 215 | So, and it turns out that the largest temperamental difference that's known between men and women 216 | 217 | 55 218 | 00:03:55,000 --> 00:03:58,000 219 | is actually interest in people versus interest in things. 220 | 221 | 56 222 | 00:03:58,000 --> 00:04:02,000 223 | And so it has nothing to do with competence, but it has a lot to do with interest. 224 | 225 | 57 226 | 00:04:02,000 --> 00:04:06,000 227 | And because you have to be very interested in things to go be an engineer, 228 | 229 | 58 230 | 00:04:06,000 --> 00:04:09,000 231 | because that's all you're going to be doing if you're an engineer, 232 | 233 | 59 234 | 00:04:09,000 --> 00:04:14,000 235 | then only those people who are extremely interested in things tend to become engineers. 236 | 237 | 60 238 | 00:04:14,000 --> 00:04:15,000 239 | And most of them are men. 240 | 241 | 61 242 | 00:04:15,000 --> 00:04:18,000 243 | And that's why even in places like Scandinavia, 244 | 245 | 62 246 | 00:04:18,000 --> 00:04:24,000 247 | where a tremendous amount of effort has been put into flattening the sociocultural landscape, 248 | 249 | 63 250 | 00:04:24,000 --> 00:04:29,000 251 | successfully, by the way, there's still a preponderance of male engineers. 252 | 253 | 64 254 | 00:04:29,000 --> 00:04:32,000 255 | And there's a preponderance of female nurses. 256 | 257 | 65 258 | 00:04:32,000 --> 00:04:37,000 259 | And no matter how much sociological gerrymandering goes on, 260 | 261 | 66 262 | 00:04:37,000 --> 00:04:43,000 263 | those statistics have remained quite intractable over about a 15-year period. 264 | 265 | 67 266 | 00:04:43,000 --> 00:04:45,000 267 | And so there are differences. 268 | 269 | 68 270 | 00:04:45,000 --> 00:04:46,000 271 | There are differences. 272 | 273 | 69 274 | 00:04:46,000 --> 00:04:48,000 275 | They're not massive. 276 | 277 | 70 278 | 00:04:48,000 --> 00:04:51,000 279 | And then you might ask, well, are those sociocultural or biological? 280 | 281 | 71 282 | 00:04:51,000 --> 00:04:54,000 283 | It's like, well, that's a hard question to answer because 284 | 285 | 72 286 | 00:04:54,000 --> 00:04:58,000 287 | it depends on how much variability there is in the sociocultural landscape 288 | 289 | 73 290 | 00:04:58,000 --> 00:05:03,000 291 | because the proportion by which something is biological versus sociocultural 292 | 293 | 74 294 | 00:05:03,000 --> 00:05:06,000 295 | varies with the sociocultural landscape. 296 | 297 | 75 298 | 00:05:06,000 --> 00:05:12,000 299 | That's a complicated thing to digest because you think of those things as fixed, but they're not. 300 | 301 | 76 302 | 00:05:12,000 --> 00:05:18,000 303 | But what we have demonstrated quite clearly, 304 | 305 | 77 306 | 00:05:18,000 --> 00:05:22,000 307 | and this is mainstream science despite the fact that people don't like it, 308 | 309 | 78 310 | 00:05:22,000 --> 00:05:24,000 311 | this test has already been done. 312 | 313 | 79 314 | 00:05:24,000 --> 00:05:28,000 315 | So we developed a personality model that's pretty stable across cultures, 316 | 317 | 80 318 | 00:05:28,000 --> 00:05:31,000 319 | purely derived from statistical processes, 320 | 321 | 81 322 | 00:05:31,000 --> 00:05:34,000 323 | an atheoretical model if there ever was one, 324 | 325 | 82 326 | 00:05:34,000 --> 00:05:37,000 327 | and quite an unattractive model because of that conceptually. 328 | 329 | 83 330 | 00:05:37,000 --> 00:05:38,000 331 | But that's beside the point. 332 | 333 | 84 334 | 00:05:38,000 --> 00:05:41,000 335 | Then we saw cross-culturally whether there were differences 336 | 337 | 85 338 | 00:05:41,000 --> 00:05:43,000 339 | in the fundamental temperaments of men and women. 340 | 341 | 86 342 | 00:05:43,000 --> 00:05:46,000 343 | And the answer was yes, cross-culturally, quite robust. 344 | 345 | 87 346 | 00:05:46,000 --> 00:05:49,000 347 | Women are higher in the experience of anxiety and emotional pain, 348 | 349 | 88 350 | 00:05:49,000 --> 00:05:51,000 351 | and they're more compassionate and agreeable. 352 | 353 | 89 354 | 00:05:51,000 --> 00:05:53,000 355 | Those are the big differences. 356 | 357 | 90 358 | 00:05:53,000 --> 00:05:56,000 359 | And they're differences of a magnitude that I already pointed out. 360 | 361 | 91 362 | 00:05:56,000 --> 00:06:01,000 363 | Then the next question is, well, to what degree is that biological versus sociocultural? 364 | 365 | 92 366 | 00:06:01,000 --> 00:06:07,000 367 | And it's complicated because that variable depends on the sociocultural landscape, 368 | 369 | 93 370 | 00:06:07,000 --> 00:06:08,000 371 | but we'll put that aside. 372 | 373 | 94 374 | 00:06:08,000 --> 00:06:11,000 375 | You can determine that by stacking up countries 376 | 377 | 95 378 | 00:06:11,000 --> 00:06:16,000 379 | from those who have done everything they possibly can 380 | 381 | 96 382 | 00:06:16,000 --> 00:06:19,000 383 | to flatten out the sociocultural landscape in relationship to gender 384 | 385 | 97 386 | 00:06:19,000 --> 00:06:23,000 387 | to those who haven't, that are still very stratified by sex. 388 | 389 | 98 390 | 00:06:23,000 --> 00:06:27,000 391 | And then what you do is you look at the magnitude of the temperament differences 392 | 393 | 99 394 | 00:06:27,000 --> 00:06:31,000 395 | in keeping with the variability that those countries have 396 | 397 | 100 398 | 00:06:31,000 --> 00:06:35,000 399 | in terms of their sociocultural egalitarianism. 400 | 401 | 101 402 | 00:06:35,000 --> 00:06:40,000 403 | And the sociocultural types, the social constructionists, 404 | 405 | 102 406 | 00:06:40,000 --> 00:06:44,000 407 | their prediction is as cultures become more egalitarian, 408 | 409 | 103 410 | 00:06:44,000 --> 00:06:47,000 411 | men and women become more different, more the same. 412 | 413 | 104 414 | 00:06:47,000 --> 00:06:50,000 415 | Sorry, more the same, because it's environmental. 416 | 417 | 105 418 | 00:06:50,000 --> 00:06:52,000 419 | That isn't what happens. 420 | 421 | 106 422 | 00:06:52,000 --> 00:06:54,000 423 | Exactly the opposite happens. 424 | 425 | 107 426 | 00:06:54,000 --> 00:06:57,000 427 | As you flatten out the sociocultural landscape, 428 | 429 | 108 430 | 00:06:57,000 --> 00:07:00,000 431 | men and women become more different. 432 | 433 | 109 434 | 00:07:00,000 --> 00:07:02,000 435 | The data is in. 436 | 437 | 110 438 | 00:07:02,000 --> 00:07:04,000 439 | The experiment is done. 440 | 441 | 111 442 | 00:07:04,000 --> 00:07:07,000 443 | Tens of thousands of people, multiple countries. 444 | 445 | 112 446 | 00:07:07,000 --> 00:07:09,000 447 | And it's not what anyone expected. 448 | 449 | 113 450 | 00:07:09,000 --> 00:07:12,000 451 | And you might think, well, it's all the right-wing psychologists. 452 | 453 | 114 454 | 00:07:12,000 --> 00:07:16,000 455 | It's like all the right-wing psychologists are in this room, 456 | 457 | 115 458 | 00:07:16,000 --> 00:07:41,000 459 | sitting in this chair. 460 | 461 | -------------------------------------------------------------------------------- /test_case/l1_export.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,260 --> 00:00:12,243 3 | - Hi everyone and welcome to the first lecture of our online course on deep learning systems, algorithms and implementation. 4 | 大家好,欢迎来到我们的深度学习系统、算法和实现在线课程的第一讲。 5 | 6 | 2 7 | 00:00:13,230 --> 00:00:23,553 8 | I'm Zico Kolter, I'm going to be giving this lecture, but I'm teaching this course with my co-instructor, Tianqi Chen, who will be giving some of the later lectures. 9 | 我是Zico Kolter,我将主讲这个讲座,但我与我的合作导师Tianqi Chen一起教授这门课程,他将在后面的讲座中主讲。 10 | 11 | 3 12 | 00:00:24,690 --> 00:00:32,190 13 | We're both faculty at Carnegie Mellon University, and we're also offering this course this Fall at CMU. 14 | 我们都是卡内基梅隆大学的教师,我们也将在CMU秋季学期开设这门课程。 15 | 16 | 4 17 | 00:00:32,190 --> 00:00:38,703 18 | But we're making all the material public as part of this online course. 19 | 但我们将所有的材料都公开作为这个在线课程的一部分。 20 | 21 | 5 22 | 00:00:39,930 --> 00:00:49,473 23 | This lecture's gonna be a basic introduction to the topics of this course, as well as cover some of the logistics of the course. 24 | 这个讲座将是关于这门课程主题的基本介绍,以及涵盖一些课程的日常事务。 25 | 26 | 6 27 | 00:00:50,640 --> 00:01:00,360 28 | As such, it's gonna be a bit different from other lectures where we'l actually go into detail about the methods, the math, the code, et cetera. 29 | 因此,它将与其他讲座有所不同,其他讲座将详细介绍方法、数学、代码等。 30 | 31 | 7 32 | 00:01:00,360 --> 00:01:10,350 33 | This is really just a lecture with slides in it, but we're gonna cover a bit about why this course might be of interest to you. 34 | 这只是一个带有幻灯片的讲座,但我们将介绍一些为什么这门课程可能对你有兴趣的内容。 35 | 36 | 8 37 | 00:01:10,350 --> 00:01:21,963 38 | Why we think these are important topics to know about, and also cover a bit of background on the logistics and setup of this course. 39 | 为什么我们认为这些是重要的主题,以及关于这门课程的背景和设置的一些背景知识。 40 | 41 | 9 42 | 00:01:23,760 --> 00:01:27,780 43 | All right, so as I said, this lecture really has two parts. 44 | 好的,正如我所说,这个讲座实际上有两个部分。 45 | 46 | 10 47 | 00:01:27,780 --> 00:01:31,380 48 | The first part is about why you should study, deep learning systems at all. 49 | 第一部分是关于为什么你应该学习深度学习系统的原因。 50 | 51 | 11 52 | 00:01:31,380 --> 00:01:33,267 53 | Why you might wanna take this course. 54 | 为什么你可能想要学习这门课程。 55 | 56 | 12 57 | 00:01:33,267 --> 00:01:37,293 58 | And the second will be more about the course info and logistics. 59 | 第二部分将更多地涉及课程信息和日常事务。 60 | 61 | 13 62 | 00:01:38,190 --> 00:01:45,123 63 | So let's jump right in and get started talking about why you might want to study deep learning systems. 64 | 所以让我们开始谈论为什么你可能想要学习深度学习系统。 65 | 66 | 14 67 | 00:01:46,740 --> 00:01:55,980 68 | Now the aim of this course is to provide you with an introduction to the functioning of modern, deep learning systems. 69 | 现在,这门课程的目的是为您提供现代深度学习系统的运作介绍。 70 | 71 | 15 72 | 00:01:55,980 --> 00:02:03,063 73 | And what that means is, you're going to learn about how these things work internally. 74 | 这意味着,您将学习这些系统的内部工作原理。 75 | 76 | 16 77 | 00:02:04,110 --> 00:02:20,100 78 | You're gonna learn about methods, like automatic differentiation, a number of basic neural network architectures, optimization, as well as methods for efficient operations on systems like GPUs. 79 | 您将学习自动微分、许多基本的神经网络架构、优化以及在GPU等系统上进行高效操作的方法。 80 | 81 | 17 82 | 00:02:20,100 --> 00:02:26,973 83 | This is how these modern deep learning systems actually are run efficiently on modern hardware. 84 | 这就是这些现代深度学习系统如何在现代硬件上高效运行的方式。 85 | 86 | 18 87 | 00:02:28,980 --> 00:02:41,850 88 | To solidify your understanding, the main effort that you'll put in throughout this course is that through the homeworks, you will develop the needle library. 89 | 为了巩固您的理解,您将通过作业开发needle库来完成这门课程的主要任务。 90 | 91 | 19 92 | 00:02:41,850 --> 00:02:46,020 93 | Needle stands for the necessary elements of deep learning. 94 | 针代表深度学习的必要元素。 95 | 96 | 20 97 | 00:02:46,020 --> 00:02:50,343 98 | And it's a deep learning library loosely similar to PyTorch. 99 | 它是一个类似于PyTorch的深度学习库。 100 | 101 | 21 102 | 00:02:52,080 --> 00:03:05,270 103 | You're going to incrementally throughout your assignments, implement many common architectures and many of the aspects of this library really from scratch. 104 | 在你的作业中,你将逐步实现许多常见的架构和许多这个库的方面,真正从头开始。 105 | 106 | 22 107 | 00:03:07,470 --> 00:03:19,650 108 | So why should you do this? Why might you want to study deep learning? And why might you want to study deep learning systems? Well, to start off with, let's answer the easier question first. 109 | 那么为什么你要这样做呢?为什么你可能想学习深度学习?为什么你可能想学习深度学习系统?首先,让我们先回答更容易的问题。 110 | 111 | 23 112 | 00:03:19,650 --> 00:03:37,140 113 | Why do you want to study, or why might you want to study deep learning? Now chances are, if you're taking this course, you probably already like deep learning or at least know about deep learning and probably have a pretty good idea about why you might want to study deep learning. 114 | 为什么你想学习深度学习,或者为什么你可能想学习深度学习?现在,如果你正在学习这门课程,你很可能已经喜欢深度学习,或者至少知道深度学习,并且可能已经对为什么你想学习深度学习有了一个很好的想法。 115 | 116 | 24 117 | 00:03:37,140 --> 00:03:51,610 118 | But I will give a few quick examples anyway, many of which you've probably already seen, but it wouldn't really be a deep learning course if we didn't start off the first lecture with some cool pictures about the things that deep learning can currently do. 119 | 但我还是会给出一些快速的例子,其中许多你可能已经看过,但如果我们没有在第一讲中展示一些深度学习目前可以做到的酷炫图片,那么这就不是一门深度学习课程了。 120 | 121 | 25 122 | 00:03:52,680 --> 00:04:08,520 123 | So maybe you heard about the famous AlexNet architecture, which was developed in 2012, which performed very, very well on the ImageNet image classification challenge. 124 | 所以也许你听说过著名的AlexNet架构,它是在2012年开发的,非常非常好地完成了ImageNet图像分类挑战。 125 | 126 | 26 127 | 00:04:08,520 --> 00:04:22,800 128 | I need to highlight right off the bat, this is not a history of deep learning, nor is it assigning credit to any sort of first elements that, first architectures of deep learning, that's an argument I do not wanna get into. 129 | 我需要强调的是,这不是深度学习的历史,也不是为深度学习的第一个元素或第一个架构分配功劳的争论,这是我不想卷入的争论。 130 | 131 | 27 132 | 00:04:22,800 --> 00:04:51,713 133 | But this was a very, very famous architecture that really at least as a field and as a technique in the public view really did turn a corner on availability and power of deep learning by essentially building an architecture that could classify images into one of 1000 classes, much better than standard computer vision techniques at the time. 134 | 但这是一个非常著名的架构,至少作为一个领域和一种技术在公众视野中真正转变了深度学习的可用性和能力,通过构建一个可以将图像分类为1000个类别的架构,比当时的标准计算机视觉技术更好。 135 | 136 | 28 137 | 00:04:53,790 --> 00:05:11,223 138 | You probably also heard about the AlphaGo system, which was developed in 2016 and defeated, not quite the world champion, I guess, or number one, but a very, very highly ranked, essentially, one of the world's best players at the game of Go. 139 | 你可能也听说过AlphaGo系统,它是在2016年开发的,击败了不是世界冠军,我想说的是排名非常高的,实际上是世界上最好的Go玩家之一。 140 | 141 | 29 142 | 00:05:12,270 --> 00:05:31,503 143 | Now the game of Go for a long time was viewed as a grand challenge for computer play of games because the number of possible moves at each location is very, very large and standard techniques like those used in chess, just weren't very applicable here. 144 | 现在,长期以来,围棋一直被视为计算机游戏的一个重大挑战,因为每个位置可能的移动数量非常大,而像在国际象棋中使用的标准技术在这里并不适用。 145 | 146 | 30 147 | 00:05:32,340 --> 00:05:53,250 148 | But using techniques from deep learning, this team at DeepMind was able to build a system that could defeat essentially at the time, one of the best players in the world, and soon after all the best human players in the world, much, much faster than I think anyone in the field really expected it to happen. 149 | 但是使用深度学习技术,DeepMind团队成功构建了一个系统,能够在当时击败世界上最好的玩家之一,不久之后又击败了全世界最好的人类玩家,比我认为领域内任何人都预料到的要快得多。 150 | 151 | 31 152 | 00:05:56,250 --> 00:06:12,660 153 | Maybe you've also heard or seen about images like these, these are images of faces generated by the StyleGAN system, and I know we're all used to seeing these things now, we're actually quite used to seeing faces that are not real, we see them everywhere now. 154 | 也许你也听说或看到过这样的图像,这些是由StyleGAN系统生成的面部图像,我知道我们现在都习惯看到这些东西了,我们实际上已经很习惯看到不真实的面孔了,我们现在到处都能看到它们。 155 | 156 | 32 157 | 00:06:12,660 --> 00:06:20,820 158 | But I remember when this post was first made on Twitter, people were advertising this paper on Twitter and I thought people were joking. 159 | 但我记得当这篇文章第一次在Twitter上发布时,人们在Twitter上宣传这篇论文,我以为人们在开玩笑。 160 | 161 | 33 162 | 00:06:20,820 --> 00:06:31,140 163 | I thought, actually, this was just a set of pictures from the training set that people were joking about and saying they were generated by the GAN, by the adversarial network. 164 | 我认为,实际上,这只是一组人们在开玩笑说是由对抗网络生成的训练集中的图片。 165 | 166 | 34 167 | 00:06:31,140 --> 00:06:35,520 168 | But no, they really were, right, these are actually fake images generated by this network. 169 | 但是不,它们真的是,这些是由这个网络生成的假图像。 170 | 171 | 35 172 | 00:06:35,520 --> 00:06:46,923 173 | And I think that we almost take it for granted now just how easy it is to generate pictures of fake people, which was a capability we did not have four or five years ago. 174 | 我认为我们现在几乎认为生成虚假人物的图片是多么容易,而这是我们四五年前所没有的能力。 175 | 176 | 36 177 | 00:06:49,260 --> 00:06:54,420 178 | A little bit more recent history now, you've likely heard about the GPT-3 system. 179 | 现在再来看一下更近期的历史,你可能听说过GPT-3系统。 180 | 181 | 37 182 | 00:06:54,420 --> 00:07:04,170 183 | This is a system built by OpenAI that can generate text and the way it generates text is it essentially writes text one word or one token at a time. 184 | 这是由OpenAI构建的一个系统,可以生成文本,它生成文本的方式是逐个单词或标记地写入文本。 185 | 186 | 38 187 | 00:07:04,170 --> 00:07:12,840 188 | So given all the previous tokens in a sentence, it predicts the next one and then it adds that, appends that to the text, and predicts the next one. 189 | 因此,给定句子中的所有先前标记,它预测下一个标记,然后将其添加到文本中,并预测下一个标记。 190 | 191 | 39 192 | 00:07:12,840 --> 00:07:31,680 193 | And from this very simple seeming process, we are nonetheless able to generate amazingly complex and coherent pieces of text just from essentially a deep learning system that's meant to predict really a distribution over next possible tokens in text. 194 | 通过这个看似简单的过程,我们仍然能够生成非常复杂和连贯的文本片段,只需要一个实际上是用于预测文本中下一个可能标记分布的深度学习系统。 195 | 196 | 40 197 | 00:07:31,680 --> 00:07:45,720 198 | And in fact here, it hopefully it's legible in the video here, but this, I actually asked GPT-3 to write a summary of this course, and it spit out a very reasonable summary of a deep learning course. 199 | 实际上,在这里,视频中希望它是可读的,但是我实际上要求GPT-3写一份关于这门课程的摘要,它输出了一份非常合理的深度学习课程摘要。 200 | 201 | 41 202 | 00:07:45,720 --> 00:07:54,480 203 | In fact, it's actually a very bad summary of this course, because it's says, we're gonna talk about the theory and the math and then we're gonna cover unsupervised learning and reinforcement learning. 204 | 实际上,这是这门课程的一个非常糟糕的摘要,因为它说,我们将讨论理论和数学,然后我们将涵盖无监督学习和强化学习。 205 | 206 | 42 207 | 00:07:54,480 --> 00:08:04,293 208 | But it would be a very good summary of a kind of generic deep learning course that will be offered that is offered, in fact here and will be offered at many, many universities. 209 | 但这将是一种通用深度学习课程的非常好的概括,这种课程在这里提供,并将在许多大学提供。 210 | 211 | 43 212 | 00:08:06,570 --> 00:08:10,470 213 | You've also probably seen AlphaFold and the AlphaFold 2 system. 214 | 你可能也看过AlphaFold和AlphaFold 2系统。 215 | 216 | 44 217 | 00:08:10,470 --> 00:08:18,720 218 | This is a system that predicts the 3D structure of proteins from their DNA sequence. 219 | 这是一个系统,可以从DNA序列预测蛋白质的三维结构。 220 | 221 | 45 222 | 00:08:18,720 --> 00:08:32,970 223 | This for a very, very long time has been a grand challenge in biology, understanding how DNA sequences form the 3D structure of proteins that actually carry out tasks in the body. 224 | 这在生物学中长期以来一直是一个重大挑战,理解DNA序列如何形成实际在身体中执行任务的蛋白质的三维结构。 225 | 226 | 46 227 | 00:08:32,970 --> 00:08:47,700 228 | And for a very, very long time, this is a chart here of the progress and accuracy of these systems over many years at sort of a well known competition on this task of protein folding prediction. 229 | 而且在这个任务的一个众所周知的竞赛中,这些系统的进展和准确性在多年中一直是一个图表。 230 | 231 | 47 232 | 00:08:47,700 --> 00:09:13,983 233 | And over the course of four years, this system, AlphaFold built by DeepMind, again, was able to really produce a amazing breakthrough, amazing scientific breakthrough in the quality and accuracy of this prediction to the point where effectively you could argue that at least in some restricted cases, this problem is in fact effectively solved. 234 | 在四年的时间里,由DeepMind构建的AlphaFold系统真正取得了惊人的突破,使这种预测的质量和准确性达到了一个可以争论的程度,至少在某些受限制的情况下,这个问题实际上已经被有效地解决了。 235 | 236 | 48 237 | 00:09:15,720 --> 00:09:26,103 238 | And finally, it wouldn't be 2022 if I didn't include a picture of an image generated by a deep learning system. 239 | 最后,如果我不包括一个由深度学习系统生成的图像,那就不是2022年了。 240 | 241 | 49 242 | 00:09:27,150 --> 00:09:34,890 243 | This is a picture generated by the Stable Diffusion system, which actually was released like a week and a half ago. 244 | 这是由Stable Diffusion系统生成的一张图片,实际上是在一周半前发布的。 245 | 246 | 50 247 | 00:09:34,890 --> 00:09:43,410 248 | In fact, it was released on the same day we announced, we also posted the video announcing this public course, so they really stole our thunder here. 249 | 事实上,它是在我们宣布这个公开课的视频发布的同一天发布的,所以他们真的抢了我们的风头。 250 | 251 | 51 252 | 00:09:43,410 --> 00:09:51,540 253 | Of course, this also relates to the work done by the DALLE-2 system and going back for the DALLE system and many papers before then. 254 | 当然,这也与DALLE-2系统以及DALLE系统和以前的许多论文有关。 255 | 256 | 52 257 | 00:09:51,540 --> 00:10:09,000 258 | But these systems are amazing in that they can take a text prompt and generate, that probably no one has ever really thought of before, and generate a very realistic painting in many cases or image in many cases that corresponds to that text. 259 | 但这些系统的惊人之处在于它们可以接受一个文本提示,并生成一个在许多情况下与该文本相对应的非常逼真的绘画或图像,这可能是没有人真正想过的。 260 | 261 | 53 262 | 00:10:09,000 --> 00:10:19,260 263 | So here I wrote the text prompt of a dog dressed as a university professor nervously preparing his first lecture of the semester, 10 minutes before the start of class. 264 | 所以在这里,我写了一个狗穿着大学教授的衣服,在开课前10分钟紧张地准备他的第一堂课的文本提示。 265 | 266 | 54 267 | 00:10:19,260 --> 00:10:23,190 268 | I don't know why I would've thought of that thing, you can imagine it yourself. 269 | 我不知道为什么我会想到那个东西,你可以自己想象。 270 | 271 | 55 272 | 00:10:23,190 --> 00:10:39,870 273 | And it was an oil painting on canvas and you see what the system generated was, well, it looks like a dog dressed as a university professor preparing a lecture, I guess 10 minutes before class, that part maybe is evident in his expression and it looks kinda like an oil painting. 274 | 这是一幅油画,画在帆布上。你可以看到系统生成的画面,看起来像一只穿着大学教授装扮的狗,正在准备讲课,也许是在上课前十分钟,这一点可能可以从他的表情中看出来,而且它看起来有点像一幅油画。 275 | 276 | 56 277 | 00:10:39,870 --> 00:10:45,220 278 | And this is just so amazing, the capabilities that we have in these systems. 279 | 这真是太神奇了,我们在这些系统中拥有的能力。 280 | 281 | 57 282 | 00:10:46,800 --> 00:10:56,370 283 | Now one thing you may notice about all these examples I give, except the very first one, is that they're all done essentially at companies, not actually the last one. 284 | 现在,你可能会注意到我给出的所有例子,除了第一个例子,基本上都是在公司完成的,实际上最后一个例子并不是。 285 | 286 | 58 287 | 00:10:56,370 --> 00:11:02,973 288 | So Stable Diffusion actually is done at a relatively small company, but they still have a fair amount of resources that were behind this effort. 289 | 因此,Stable Diffusion实际上是由一个相对较小的公司完成的,但他们仍然有相当多的资源投入到这个项目中。 290 | 291 | 59 292 | 00:11:04,770 --> 00:11:11,580 293 | And the other point I wanna make though, is in case you're a little bit concerned saying, oh, all this stuff is just happening at big companies. 294 | 我想要强调的另一个观点是,如果你有点担心说,哦,所有这些东西都只是在大公司发生。 295 | 296 | 60 297 | 00:11:11,580 --> 00:11:25,830 298 | What can one person or a small group of people really do to influence this? I would, first of all, point to that first paper and Stable Diffusion paper actually is bookend examples of what a few people can do with the right methods and the right cleverness. 299 | 一个人或一个小团队真的能做些什么来影响这个领域吗?首先,我想指出那篇第一篇论文和Stable Diffusion论文实际上是几个人用正确的方法和正确的聪明才智所做出的两个例子。 300 | 301 | 61 302 | 00:11:25,830 --> 00:11:35,883 303 | But I wanna highlight a few examples too, of smaller efforts that I think have still been amazingly impressive at shaping the field of deep learning. 304 | 但我还想强调一些例子,这些例子是由我认为仍然非常令人印象深刻的小型努力所塑造的深度学习领域的。 305 | 306 | 62 307 | 00:11:37,210 --> 00:11:53,970 308 | So the DeOldify work essentially done by two people is more or less, or was, I believe still is more or less, a state of the art technique for taking old pictures, old photographs in black and white and creating color versions of these. 309 | DeOldify工作基本上是由两个人完成的,或者说是,我相信仍然是,将黑白老照片转换成彩色版本的最先进技术。 310 | 311 | 63 312 | 00:11:53,970 --> 00:12:10,710 313 | Now image colorization has been researched as a topic for a long time, but this system really is an effort of a few people that ultimately achieves, I think the visually best version of this sort of task that I have seen from this. 314 | 现在,图像着色作为一个主题已经被研究了很长时间,但这个系统真的是几个人的努力,最终实现了我从这个任务中看到的最好的视觉版本。 315 | 316 | 64 317 | 00:12:10,710 --> 00:12:14,880 318 | Done essentially by two people with very limited resources, at least in the initial versions. 319 | 最初版本基本上是由两个人用非常有限的资源完成的。 320 | 321 | 65 322 | 00:12:16,620 --> 00:12:23,253 323 | If you work in computer vision these days, you've probably heard of the PyTorch image models or timm library. 324 | 如果你现在从事计算机视觉工作,你可能已经听说过PyTorch图像模型或timm库。 325 | 326 | 66 327 | 00:12:24,120 --> 00:12:45,900 328 | This is essentially work by one person that wanted to implement a whole bunch of, with some help now, but at least starting out one person, Ross Wightman, who wanted to implement a whole lot of deep learning image classification models from many, many papers and test them all out on benchmark data. 329 | 这实际上是一个人的工作,他想要实现许多深度学习图像分类模型,从许多论文中测试它们在基准数据上的表现,虽然现在有一些帮助,但至少起初是一个人,Ross Wightman。 330 | 331 | 67 332 | 00:12:45,900 --> 00:12:50,490 333 | And in many cases using pre-trained weights from those papers or many cases, training them from scratch. 334 | 在许多情况下,使用那些论文中的预训练权重,或者从头开始训练。 335 | 336 | 68 337 | 00:12:50,490 --> 00:13:07,293 338 | And this has been, started at least as a relatively small effort by one person and has become really the dominant image classification library that we all use academically when we are building these vision systems. 339 | 这至少是由一个人相对较小的努力开始的,并且已经成为我们在构建这些视觉系统时学术上使用的主要图像分类库。 340 | 341 | 69 342 | 00:13:08,880 --> 00:13:31,680 343 | And finally, I won't highlight these other ones actually, because these in fact are community efforts, but there's been many other examples of libraries, systems, big, big sort of code endeavors that are essentially community driven and that they are for both libraries and frameworks that have been community driven that have really driven the field forward. 344 | 最后,我不会实际突出这些其他的,因为事实上它们是社区努力,但还有许多其他的库、系统、大型代码项目,它们本质上是社区驱动的,它们是为了库和框架,这些库和框架真正推动了该领域的发展。 345 | 346 | 70 347 | 00:13:31,680 --> 00:13:39,513 348 | And I'll actually mention some of these again when I introduce briefly my co-teacher in this course, Tianqi. 349 | 当我简要介绍这门课的合作教师Tianqi时,我将再次提到其中的一些。 350 | 351 | 71 352 | 00:13:42,060 --> 00:13:47,223 353 | So all of this that I've talked about so far probably is not news to you. 354 | 到目前为止,我所谈论的所有内容可能对你来说并不新鲜。 355 | 356 | 72 357 | 00:13:48,150 --> 00:13:58,950 358 | If you're watching this, you probably say, yes, I get it, deep learning is great, that's why I'm taking this course, that's why I'm listening to this video so far, if you haven't skipped forward already. 359 | 如果你正在观看这个视频,你可能会说,是的,我明白,深度学习很棒,这就是为什么我要学这门课,这就是为什么我要听这个视频,如果你还没有跳过去的话。 360 | 361 | 73 362 | 00:14:00,030 --> 00:14:34,893 363 | But why should you learn about deep learning systems? Why do you actually want to study deep learning systems? Not just deep learning, but the actual architectures behind that enable these systems and the way I'm going to motivate this is I'm going to show a chart here of a Google Trends chart of the interest measured somehow in deep learning, the term deep learning over the past 15 years or so, 14 years. 364 | 但是你为什么要学习深度学习系统呢?为什么你真正想要研究深度学习系统?不仅仅是深度学习,而是实际的架构,使这些系统成为可能的架构,我要激励的方式是,我将展示一个谷歌趋势图表,显示过去15年或14年中深度学习这个术语的兴趣测量情况。 365 | 366 | 74 367 | 00:14:36,420 --> 00:14:42,660 368 | And I'm gonna annotate this chart with a few events of note. 369 | 我将用一些注释来标注这个图表中的一些值得注意的事件。 370 | 371 | 75 372 | 00:14:42,660 --> 00:14:53,430 373 | So in the late 2000s, this is actually when the field of deep learning in some sense took off academically. 374 | 在2000年代后期,这实际上是深度学习领域在学术上起飞的时候。 375 | 376 | 76 377 | 00:14:53,430 --> 00:15:08,733 378 | So I was going to conferences at this time and I remember at conferences like NeurIPS, this deep learning became a thing, a field where there were lots of papers in it every year in the late 2000s. 379 | 所以我在那个时候参加会议,我记得在像NeurIPS这样的会议上,深度学习成为了一个领域,在那里每年都有很多论文。 380 | 381 | 77 382 | 00:15:09,840 --> 00:15:13,410 383 | But still, maybe this is always how academic work happens. 384 | 但是,也许这总是学术工作的方式。 385 | 386 | 78 387 | 00:15:13,410 --> 00:15:18,030 388 | Still, there wasn't much as measured by Google Trends relative to the current day. 389 | 390 | 79 391 | 00:15:18,030 --> 00:15:30,280 392 | There wasn't a whole lot of interest in deep learning, it was just sort of an academic trend like many others that you've probably not heard of because they were 15 years old and no one's using them anymore. 393 | 它只是一个学术趋势,就像你可能从未听说过的其他15年前的趋势一样,现在也没有人再使用它们了。 394 | 395 | 80 396 | 00:15:31,770 --> 00:15:59,280 397 | Then in 2012, as I mentioned, the AlexNet network was released, which again, this is not a history of the field of deep learning, and I've of course should also mention, though I should, of course mention that the actual mathematics of deep learning and neural networks goes back well into the 80s and probably before then to the 70s, this is just a sort of recent history, of course. 398 | 然后在2012年,正如我所提到的,AlexNet网络被发布了,再次强调,这不是深度学习领域的历史,当然我也应该提到,深度学习和神经网络的实际数学基础可以追溯到80年代甚至70年代之前,这只是最近的历史,当然。 399 | 400 | 81 401 | 00:15:59,280 --> 00:16:07,023 402 | And again, I'm only annotating a few events, not trying to make claims about who was first to do what, et cetera, it's a game I don't wanna play in. 403 | 而且,我只注释了一些事件,而不是试图声称谁是第一个做什么的,等等,这是我不想玩的游戏。 404 | 405 | 82 406 | 00:16:08,430 --> 00:16:19,770 407 | But the AlexNet was a very popular architecture, yet still, and there started to be a little uptick in interest in deep learning, but still not too much happened. 408 | 但是AlexNet是一个非常流行的架构,然而,深度学习的兴趣开始有所增加,但仍然没有太多的发展。 409 | 410 | 83 411 | 00:16:19,770 --> 00:16:25,090 412 | So state of the art performance on image classification and still not too much happened. 413 | 因此,在图像分类的最新性能方面,仍然没有太多的发展。 414 | 415 | 84 416 | 00:16:26,250 --> 00:16:34,470 417 | So then what happened? When did this start to really take off? Well, a few other things happened in the later years. 418 | 那么接下来发生了什么?这是什么时候开始真正起飞的?后来的几年发生了一些其他的事情。 419 | 420 | 85 421 | 00:16:34,470 --> 00:16:43,283 422 | So in 2015, in 2016, some libraries like Keras and TensorFlow and PyTorch were released. 423 | 因此,在2015年和2016年,一些库,如Keras、TensorFlow和PyTorch被发布了。 424 | 425 | 86 426 | 00:16:44,250 --> 00:17:02,463 427 | And if you actually look at the timing of when deep learning became truly popular, it coincides much more with the release of these libraries than the actual sort of what we think of as some of the big notable papers or events in the field. 428 | 如果你真正看一下深度学习变得真正流行的时间,它与这些库的发布时间更加吻合,而不是我们认为的一些重要的论文或事件。 429 | 430 | 87 431 | 00:17:03,390 --> 00:17:22,677 432 | And so I kind of wanna make the controversial, but maybe not that controversial claim that the single largest driver of the widespread adoption of deep learning has been the creation of what essentially amounts to, easy to use automatic differentiation libraries. 433 | 因此,我想要提出一个有争议但可能并不那么有争议的观点,即深度学习广泛采用的最大驱动力是创建了一些易于使用的自动微分库。 434 | 435 | 88 436 | 00:17:22,677 --> 00:17:25,830 437 | Now that's a little bit too simplified, of course. 438 | 当然,这有点过于简化了。 439 | 440 | 89 441 | 00:17:25,830 --> 00:17:31,200 442 | The actual deep learning systems, which we're gonna talk about in this course involve much more than automatic differentiation. 443 | 实际的深度学习系统,我们将在本课程中讨论,涉及的远不止自动微分。 444 | 445 | 90 446 | 00:17:31,200 --> 00:17:41,130 447 | But this core technology, which again goes back to the 70s, not a new technology, but the widespread avail, and there were frameworks before that. 448 | 但是这个核心技术,它再次回到了70年代,不是一项新技术,但是广泛的可用性,之前也有一些框架。 449 | 450 | 91 451 | 00:17:41,130 --> 00:17:48,840 452 | So before PyTorch, there was Torch, just not many people used it, because you had to learn a whole new language called Lua to implement your models there. 453 | 在PyTorch之前,有Torch,只是没有太多人使用它,因为你必须学习一种叫做Lua的全新语言来实现你的模型。 454 | 455 | 92 456 | 00:17:48,840 --> 00:17:59,820 457 | So the availability of Python based frameworks that lets you quickly prototype new architectures, new models. 458 | 因此,基于Python的框架的可用性,让你可以快速地原型化新的架构、新的模型。 459 | 460 | 93 461 | 00:17:59,820 --> 00:18:08,343 462 | This I think was the single biggest driver of the explosion of interest in deep learning. 463 | 我认为这是深度学习兴趣爆炸的最大推动力。 464 | 465 | 94 466 | 00:18:09,690 --> 00:18:15,570 467 | Now one thing you may also see from this chart is maybe we're in bad territory recently, maybe something's happening recently. 468 | 现在你可能会从这张图表中看到一些不好的趋势,可能最近发生了一些事情。 469 | 470 | 95 471 | 00:18:15,570 --> 00:18:22,170 472 | I don't think it is I think, there's often issues with sort of the latest data in Google Trends. 473 | 我认为不是这样的,我认为通常在Google Trends的最新数据中会有问题。 474 | 475 | 96 476 | 00:18:22,170 --> 00:18:33,000 477 | But more than that, I think probably was also happening is that a lot of these things are just now falling under the umbrella of AI, which I will try to avoid that term, I'll try to be specific about deep learning as much as possible. 478 | 但更重要的是,我认为可能正在发生的是,很多这些事情现在都被归为人工智能的范畴,我会尽可能避免使用这个术语,我会尽可能具体地谈论深度学习。 479 | 480 | 97 481 | 00:18:33,000 --> 00:18:38,913 482 | But probably a lot what's happening, is people are just using the term AI to talk about a lot of these things and not the term deep learning always. 483 | 但可能正在发生的是,人们只是用“人工智能”这个术语来谈论很多这些事情,而不总是用“深度学习”的术语。 484 | 485 | 98 486 | 00:18:40,530 --> 00:18:48,380 487 | So another way of sort of emphasizing this exact same point, I'm actually going to reference of story from Tianqi's work. 488 | 为了强调这个完全相同的观点,我要引用Tianqi工作中的一个故事。 489 | 490 | 99 491 | 00:18:49,350 --> 00:18:58,770 492 | And he, I actually was quite, I admit, I was quite late to the game when it came to deep learning, despite being around people that were using it, some of the pioneers in the field. 493 | 我承认,尽管周围有一些领域的先驱在使用它,但我对深度学习的了解相当晚。 494 | 495 | 100 496 | 00:18:58,770 --> 00:19:01,893 497 | I actually didn't start working in deep learning until about 2015. 498 | 我直到2015年才开始从事深度学习。 499 | 500 | 101 501 | 00:19:03,000 --> 00:19:07,353 502 | Maybe not surprisingly about when I could easily prototype stuff. 503 | 也许不出所料,当我可以轻松地原型制作时。 504 | 505 | 102 506 | 00:19:08,790 --> 00:19:18,510 507 | But Tianqi, he was actually working on deep learning back in the day, back in 2012, when a lot of these architectures were first being developed. 508 | 但是,Tianqi实际上在2012年就开始研究深度学习了,当时很多这些架构都是首次开发的。 509 | 510 | 103 511 | 00:19:18,510 --> 00:19:35,703 512 | And in fact, one of his first projects as a PhD student was to write code for ConvNets that would accelerate their development on GPUs this around the same time that AlexNet and such was being developed and so he was doing similar things at the time. 513 | 事实上,他作为博士生的第一个项目之一就是编写ConvNets的代码,以加速它们在GPU上的开发,这大约是在AlexNet等同时期开发的,所以他当时也在做类似的事情。 514 | 515 | 104 516 | 00:19:37,080 --> 00:19:57,750 517 | And the figures he gives is that to implement really a capable convolution architecture for image classification on a data set like ImageNet at the time, it took him about 44,000 lines of code and about six months of coding to do so. 518 | 他给出的数字是,要在像ImageNet这样的数据集上实现真正有能力的卷积架构,他需要大约44,000行代码和大约六个月的编码时间。 519 | 520 | 105 521 | 00:19:57,750 --> 00:20:07,923 522 | And I'll make this point later, but Tianqi is a really good coder and it still took him this long to write a working deep learning architecture. 523 | 我稍后会提到这一点,但是Tianqi是一个非常好的编码人员,他仍然需要这么长时间来编写一个工作的深度学习架构。 524 | 525 | 106 526 | 00:20:09,960 --> 00:20:21,240 527 | Contrast that with today, today, if you wanna do the same thing, you would probably have to write about 100 lines of code and you could probably do it in a few hours. 528 | 与今天相比,如果你想做同样的事情,你可能需要编写约100行代码,而且可能只需要几个小时。 529 | 530 | 107 531 | 00:20:21,240 --> 00:20:30,243 532 | And the reason why is because of deep learning systems like PyTorch, like TensorFlow and now like JAX. 533 | 原因是因为像PyTorch、TensorFlow和现在的JAX这样的深度学习系统。 534 | 535 | 108 536 | 00:20:32,280 --> 00:20:42,780 537 | And I think we often don't fully appreciate just how much of an enabling factor it is to be able to iterate this quickly. 538 | 我认为我们经常没有完全意识到能够如此快速迭代的能力有多么重要。 539 | 540 | 109 541 | 00:20:42,780 --> 00:20:47,970 542 | We think of deep learning models as being slow to train and slow to develop and especially large ones. 543 | 我们认为深度学习模型训练和开发速度慢,特别是大型模型。 544 | 545 | 110 546 | 00:20:47,970 --> 00:20:58,623 547 | But this is amazingly fast, we have an amazingly fast current iteration time enabled by these deep learning systems. 548 | 但是这是惊人的快速,我们有这些深度学习系统提供的惊人的快速迭代时间。 549 | 550 | 111 551 | 00:21:01,890 --> 00:21:11,553 552 | But this still doesn't answer the question that I set out to answer, which is, why should you take this course? So maybe you agree now that deep learning systems are great. 553 | 但这仍然没有回答我要回答的问题,那就是,为什么你应该学习这门课程?所以也许你现在同意深度学习系统很棒。 554 | 555 | 112 556 | 00:21:12,450 --> 00:21:18,753 557 | Why don't you just use them, right? You can just use, I'm sure you already do, right? You probably use PyTorch, and TensorFlow and JAX. 558 | 为什么不直接使用它们呢?你可以使用,我相信你已经在使用PyTorch、TensorFlow和JAX了。 559 | 560 | 113 561 | 00:21:20,040 --> 00:21:39,300 562 | Why should you take a course about how these systems actually work? And there I actually think there are three reasons, I'm going to give for why this course might be right for you to take if you are interested in deep learning. 563 | 为什么你应该学习这些系统的工作原理?我认为有三个原因,如果你对深度学习感兴趣,那么这门课程可能适合你。 564 | 565 | 114 566 | 00:21:40,530 --> 00:21:49,230 567 | The first reason of course is, maybe obviously, if you want to build deep learning systems, you better understand them. 568 | 第一个原因当然是,如果你想构建深度学习系统,你最好了解它们。 569 | 570 | 115 571 | 00:21:50,970 --> 00:22:01,470 572 | So despite the current state of deep learning libraries where you may say that, okay, libraries like TensorFlow and PyTorch kind of won, they're the standards everyone uses. 573 | 尽管当前深度学习库的状态可能是,TensorFlow和PyTorch赢了,它们是每个人使用的标准。 574 | 575 | 116 576 | 00:22:02,340 --> 00:22:04,320 577 | It's actually not really true. 578 | 但实际上并不是真的。 579 | 580 | 117 581 | 00:22:04,320 --> 00:22:18,647 582 | I think actually the field of deep learning systems is remarkably fluid as evidenced by the relatively recent emergence of JAX as a dominant framework for a lot of research in deep learning. 583 | 我认为深度学习系统领域实际上非常流动,这可以通过JAX作为深度学习研究的主要框架的相对近期出现来证明。 584 | 585 | 118 586 | 00:22:18,647 --> 00:22:21,990 587 | It's a relatively new thing, this happened the last couple years. 588 | 这是一个相对较新的事情,发生在过去几年中。 589 | 590 | 119 591 | 00:22:23,130 --> 00:22:37,590 592 | But I don't think we're done yet in some way, I think there's actually a lot of work to be done in developing new systems, maybe more specialized systems, maybe systems that specialize in some different area or different paradigm for deep learning. 593 | 但我认为我们还没有完成,我认为在开发新系统方面还有很多工作要做,也许是更专业的系统,也许是专门针对深度学习的不同领域或不同范式的系统。 594 | 595 | 120 596 | 00:22:37,590 --> 00:22:43,080 597 | But I don't think we're finished with what the final state of deep learning systems is gonna look like. 598 | 但我认为我们还没有完成深度学习系统的最终状态会是什么样子。 599 | 600 | 121 601 | 00:22:43,080 --> 00:23:00,330 602 | And if you want to develop your own frameworks or build upon existing frameworks and by the way, all the frameworks out there essentially are open source, so you could definitely just download them, the source currently and start contributing to it if you understand them. 603 | 如果你想开发自己的框架或建立在现有框架之上,顺便说一下,所有框架本质上都是开源的,所以如果你了解它们,你肯定可以下载它们的源代码并开始为它们做出贡献。 604 | 605 | 122 606 | 00:23:00,330 --> 00:23:07,550 607 | If you want to do all that, then this course, and some practice will prepare you to do this. 608 | 如果你想做到这一切,那么这门课程和一些实践将会为你做好准备。 609 | 610 | 123 611 | 00:23:07,550 --> 00:23:15,353 612 | So this is maybe the most obvious reason why you might wanna take this course if you want to build and contribute to these libraries as well. 613 | 因此,如果你想构建和贡献于这些库,这可能是最明显的原因为什么你想要学习这门课程。 614 | 615 | 124 616 | 00:23:17,700 --> 00:23:28,263 617 | But that's not the only reason, and the second reason for taking this course is actually the one that I would emphasize most heavily for practitioners in the field. 618 | 但这不是唯一的原因,第二个学习这门课程的原因实际上是我最强调的原因。 619 | 620 | 125 621 | 00:23:29,490 --> 00:23:42,813 622 | And that reason is, understanding how the internals of deep learning systems work lets you use them more efficiently and more effectively. 623 | 这个原因是,了解深度学习系统的内部工作原理可以让你更有效地使用它们。 624 | 625 | 126 626 | 00:23:44,850 --> 00:24:03,270 627 | And I really do mean that, right? So if you want to build scalable models, efficient models, models that will execute quickly or that make full utilization of a GPU, you really do want to understand how these systems are working underneath the hood. 628 | 我真的是这个意思,如果你想构建可扩展的模型、高效的模型、快速执行或充分利用GPU的模型,你真的需要了解这些系统在引擎盖下的工作原理。 629 | 630 | 127 631 | 00:24:03,270 --> 00:24:22,560 632 | What is really being executed? How are they translating your high level description of a network architecture, to something that really executes on hardware and then trains and differentiates that system and adjust parameters and all that. 633 | 634 | 128 635 | 00:24:22,560 --> 00:24:31,470 636 | How does that work and understanding how that works will actually enable you to write more efficient and more effective code. 637 | 了解这个过程将使你能够编写更高效、更有效的代码。 638 | 639 | 129 640 | 00:24:31,470 --> 00:24:34,703 641 | And this is especially true if you're doing research in deep learning. 642 | 如果你正在进行深度学习的研究,这尤其正确。 643 | 644 | 130 645 | 00:24:34,703 --> 00:24:42,060 646 | So especially if you are doing things like, developing new kinds of layers, new architectures, new structures in deep learning. 647 | 特别是如果你正在开发新的层、新的架构、新的深度学习结构等等。 648 | 649 | 131 650 | 00:24:42,060 --> 00:24:51,030 651 | This will be vastly improved if you understand the logic and the mechanisms behind these systems. 652 | 如果你理解这些系统背后的逻辑和机制,这将大大提高你的研究效率。 653 | 654 | 132 655 | 00:24:51,030 --> 00:25:05,163 656 | I've always kind of referred to understanding deep learning systems as a kind of superpower that can let you accomplish your research aims even if your research aims are not about system building can enable you to accomplish them much more efficiently. 657 | 我一直认为理解深度学习系统是一种超能力,即使你的研究目标不是系统构建,也可以让你更有效地实现它们。 658 | 659 | 133 660 | 00:25:07,920 --> 00:25:14,403 661 | This is probably the main reason why most of you, I think, can and should take this course. 662 | 这可能是大多数人学习这门课程的主要原因。 663 | 664 | 134 665 | 00:25:15,780 --> 00:25:24,003 666 | But I would be remiss if I didn't add one more reason to this pile, which is that, deep learning systems are really, really cool. 667 | 但如果我不再加上一个原因,那就是深度学习系统真的很酷。 668 | 669 | 135 670 | 00:25:25,440 --> 00:25:31,653 671 | And the reason why these systems are so much fun is actually very simple. 672 | 这些系统之所以如此有趣的原因实际上非常简单。 673 | 674 | 136 675 | 00:25:32,670 --> 00:25:42,993 676 | And that is, that despite the seeming complexity of these things, PyTorch and TensorFlow at this point are millions of lines of code. 677 | 尽管PyTorch和TensorFlow看起来非常复杂,但它们实际上是数百万行代码。 678 | 679 | 137 680 | 00:25:44,010 --> 00:26:01,263 681 | But despite the seeming complexity of these libraries, the core underlying algorithms behind deep learning systems, behind quite capable deep learning systems, to be honest, are extremely, extremely simple. 682 | 但是,尽管这些库看起来很复杂,但深度学习系统背后的核心算法实际上非常简单。 683 | 684 | 138 685 | 00:26:02,190 --> 00:26:17,130 686 | Really the core algorithms behind every single deep learning architecture, every single, all of those advances in machine learning models that you saw that I put up on those previous screens. 687 | 实际上,每个深度学习架构的核心算法,包括我在之前的屏幕上展示的所有机器学习模型的进展,都基本上是基于自动微分和基于梯度的优化。 688 | 689 | 139 690 | 00:26:17,130 --> 00:26:31,980 691 | At least algorithmically, they're all essentially based upon automatic differentiation and gradient based optimization, at least from a mathematical standpoint, those are the two or handful of algorithms that actually underlie all of this. 692 | 至少从数学的角度来看,这是所有这些算法的基础。 693 | 694 | 140 695 | 00:26:31,980 --> 00:26:46,443 696 | And then on the implementation side, essentially, they are built upon efficient linear algebra, especially efficient matrix multiplies on GPU systems. 697 | 然后,在实现方面,它们基本上是建立在高效的线性代数上,特别是在GPU系统上的高效矩阵乘法上。 698 | 699 | 141 700 | 00:26:48,120 --> 00:26:57,153 701 | Unlike say an operating system where if you wanna build an operating system, you really have to build quite a bit of code, you have to write a lot of code. 702 | 与操作系统不同,如果你想要构建一个操作系统,你实际上需要构建相当多的代码,需要编写大量的代码。 703 | 704 | 142 705 | 00:26:59,550 --> 00:27:04,290 706 | And so courses on operating systems that take you through operating systems and usually build a very, very basic one. 707 | 因此,操作系统课程通常会带你通过操作系统并构建一个非常基本的操作系统。 708 | 709 | 143 710 | 00:27:04,290 --> 00:27:10,470 711 | And you have to write, even for that, you have to write a lot of code to do anything at all reasonable. 712 | 即使对于那个非常基本的操作系统,你也必须编写大量的代码才能做出任何合理的事情。 713 | 714 | 144 715 | 00:27:10,470 --> 00:27:19,950 716 | But you actually could write and you will write a reasonable deep learning library, if you wanna be really compact with your code, you could probably do it in less than 2000 lines of code. 717 | 但是,如果你想要非常紧凑地编写一个合理的深度学习库,你实际上可以在不到2000行代码的情况下完成。 718 | 719 | 145 720 | 00:27:21,000 --> 00:27:31,740 721 | Something that will run on a GPU that will do automatic differentiation, that will have operations like convolutions and convolution networks, recurrent networks, transformers, all this kind of thing, right. 722 | 723 | 146 724 | 00:27:31,740 --> 00:27:38,043 725 | You can do it in almost no code because the actual ideas underlying these systems are simple. 726 | 你几乎可以用很少的代码完成。因为这些系统背后的实际思想是简单的。 727 | 728 | 147 729 | 00:27:40,350 --> 00:27:48,510 730 | And they're also, and I say this a little bit tongue in cheek, but they're also kind of magical. 731 | 而且,我有点开玩笑地说,它们也有点神奇。 732 | 733 | 148 734 | 00:27:50,280 --> 00:28:05,240 735 | Before I worked in deep learning, I sort of was brought up in traditional machine learning when we derived all our gradients by hand, and that was the big effort you went through when you derived some new model, as you wrote out a bunch of gradients by hand. 736 | 在我还没有涉足深度学习之前,我是传统机器学习的信徒,我们通过手动推导所有的梯度,这是你推导新模型时需要付出的巨大努力,你需要手写一堆梯度。 737 | 738 | 149 739 | 00:28:06,660 --> 00:28:33,933 740 | I remember the first time I built an automatic differentiation library and I realized that I could take, form some complex expression, take its gradient and then form an even more complex expression of its gradient and differentiate through that thing, and do all that despite the fact that I actually would really struggle to even derive that by hand. 741 | 我记得第一次构建自动微分库时,我意识到我可以从一些复杂的表达式中取出梯度,然后形成一个更复杂的梯度表达式,并通过那个东西进行微分,尽管我实际上会很难手动推导出来。 742 | 743 | 150 744 | 00:28:35,190 --> 00:28:42,573 745 | I probably could do it, but it would take me quite a while to derive this manually yet I could write some code that did it. 746 | 我可能能够做到,但手动推导需要花费相当长的时间,而我可以编写一些代码来完成它。 747 | 748 | 151 749 | 00:28:43,560 --> 00:28:46,230 750 | This is really, really cool. 751 | 这真的很酷。 752 | 753 | 152 754 | 00:28:46,230 --> 00:28:50,240 755 | And it's an experience I think everyone working in deep learning should have. 756 | 我认为每个从事深度学习的人都应该有这样的经历。 757 | 758 | 153 759 | 00:28:52,590 --> 00:29:02,793 760 | All right, so with all that being said, let me give a little bit more now boring information about this course and the logistics of this course. 761 | 好的,说了这么多,让我再介绍一下这门课程和课程的后勤方面。 762 | 763 | 154 764 | 00:29:05,880 --> 00:29:10,880 765 | First up to introduce myself and my co-instructor Tianqi. 766 | 首先是介绍我和我的合作导师Tianqi。 767 | 768 | 155 769 | 00:29:13,050 --> 00:29:19,023 770 | I am a faculty member at Carnegie Mellon, I've been there since 2012. 771 | 我是卡内基梅隆大学的教职员工,自2012年以来一直在那里工作。 772 | 773 | 156 774 | 00:29:20,430 --> 00:29:26,640 775 | But in addition to working in industry or at CMU, I've also done a fair amount of work in industry. 776 | 但除了在工业界或卡内基梅隆大学工作外,我还在工业界做了很多工作。 777 | 778 | 157 779 | 00:29:26,640 --> 00:29:29,040 780 | So I was previously at a company called C3 AI. 781 | 所以我以前在一个叫做C3 AI的公司工作。 782 | 783 | 158 784 | 00:29:29,040 --> 00:29:34,683 785 | Now I work, I'm a chief scientist in AI research at Bosch and the Bosch Center for AI. 786 | 现在我是博世和博世人工智能中心的首席科学家。 787 | 788 | 159 789 | 00:29:35,880 --> 00:29:48,570 790 | And my research in academics focuses on a lot of techniques for new algorithms and new methods now in deep learning. 791 | 我的学术研究主要集中在深度学习的新算法和新方法上。 792 | 793 | 160 794 | 00:29:48,570 --> 00:29:59,520 795 | So I've done a lot of work on adversarial robustness, I've done a lot of work, especially certified and provable defenses against adversarial attacks. 796 | 所以我在对抗性鲁棒性方面做了很多工作,尤其是针对对抗性攻击的认证和可证明的防御。 797 | 798 | 161 799 | 00:29:59,520 --> 00:30:19,110 800 | Also done a lot of work in what we call implicit layers, these are layers that instead of just being formed by some sort of stacking of traditional operations, you form them by actually solving a more complex operator like an optimization problem, or like a fixed point equation. 801 | 还在所谓的隐式层方面做了很多工作,这些层不仅仅是通过传统操作的堆叠形成的,而是通过解决更复杂的运算符(如优化问题或固定点方程)来形成的。 802 | 803 | 162 804 | 00:30:19,110 --> 00:30:21,270 805 | And you actually differentiate through those analytically. 806 | 你可以通过这些层进行解析微分。 807 | 808 | 163 809 | 00:30:21,270 --> 00:30:28,740 810 | In fact, we'll according to the current schedule, at least, if there is time, we will have a lecture on implicit layers at the very end of this course. 811 | 事实上,根据当前的时间表,如果有时间的话,我们将在这门课程的最后一节课上讲解隐式层。 812 | 813 | 164 814 | 00:30:28,740 --> 00:30:30,990 815 | Implemented, of course, in our own framework. 816 | 当然,我们会在我们自己的框架中实现它。 817 | 818 | 165 819 | 00:30:32,190 --> 00:30:47,520 820 | I was also an early PyTorch adopter, and one of my marks of pride, I'm going to quickly sort of not hold a candle to the system's work, Tianqi has done that, I'm about to show in a second. 821 | 我也是早期的PyTorch采用者之一,我要快速地展示一下我自己的成就,虽然我不会像Tianqi所做的那样。 822 | 823 | 166 824 | 00:30:47,520 --> 00:30:57,420 825 | But myself and my group, we were early PyTorch adopters, we were actually mentioned as the first group releasing third party libraries for PyTorch. 826 | 但是我和我的团队,我们是早期的PyTorch采用者,实际上我们被提及为第一个发布PyTorch第三方库的团队。 827 | 828 | 167 829 | 00:30:57,420 --> 00:31:16,770 830 | And one of my claims to fame there is that as part of our efforts to release an optimization layer, so this was a layer, a third party library that would solve optimization problems as a layer in a deep networks like quadratic programs, if you know what those are. 831 | 832 | 168 833 | 00:31:16,770 --> 00:31:32,160 834 | And to do so, I wrote a CUDA kernel as part of PyTorch that could do batch parallel solving of multiple linear systems as part of our, as one step of our optimization solver. 835 | 我编写了一个CUDA内核作为PyTorch的一部分,可以批量并行解决多个线性系统,作为我们优化求解器的一步。 836 | 837 | 169 838 | 00:31:32,160 --> 00:31:47,220 839 | And the real claim to fame there, of course, is that in doing so I messed up or rather, I wouldn't standardize somehow the matrix striding that PyTorch assumes coming out of its CUDA kernels. 840 | 841 | 170 842 | 00:31:47,220 --> 00:31:58,590 843 | And I introduced a bug in PyTorch's linear solver that I think persisted for a year after that, just everyone was so confused about why this linear solver would just randomly crash at times. 844 | 这导致我在PyTorch的线性求解器中引入了一个错误,我认为这个错误持续了一年之久,每个人都很困惑为什么这个线性求解器会在某些时候随机崩溃。 845 | 846 | 171 847 | 00:31:58,590 --> 00:32:02,883 848 | So that's my claim to fame, I guess, sadly about deep learning systems. 849 | 所以这就是我在深度学习系统方面的成就,我想,可悲的是。 850 | 851 | 172 852 | 00:32:03,780 --> 00:32:07,170 853 | Now the other instructor is a bit different. 854 | 现在另一个讲师有点不同。 855 | 856 | 173 857 | 00:32:07,170 --> 00:32:12,170 858 | So Tianqi Chen is also a faculty member at CMU. 859 | 860 | 174 861 | 00:32:12,360 --> 00:32:23,430 862 | And also in addition to this has a foot in industry, so he was the co-founder of the OctoML company, which is a company now does a lot of support and development for the TVM library. 863 | 此外还在工业界有所涉足,他是OctoML公司的联合创始人,该公司现在为TVM库提供了很多支持和开发。 864 | 865 | 175 866 | 00:32:23,430 --> 00:32:25,650 867 | But the real claim to fame is the following. 868 | 但真正的成就是以下。 869 | 870 | 176 871 | 00:32:25,650 --> 00:32:34,290 872 | So I'm giving this lecture so I can suitably embarrass Tianqi a little bit in our introduction here. 873 | 我正在讲这个讲座,所以我可以在这里适当地让陈天奇有点尴尬。 874 | 875 | 177 876 | 00:32:34,290 --> 00:32:46,440 877 | For a long time, the standard story I will give about him is that in deep learning systems or machine learning systems as a whole, there really are three big players in this field. 878 | 很长一段时间以来,我会给他一个标准的故事,即在深度学习系统或整个机器学习系统中,实际上有三个大玩家。 879 | 880 | 178 881 | 00:32:46,440 --> 00:32:51,360 882 | There is Google, of course, releasing TensorFlow, JAX and many other libraries. 883 | 当然有谷歌,发布TensorFlow、JAX和许多其他库。 884 | 885 | 179 886 | 00:32:51,360 --> 00:32:58,980 887 | There's Facebook, of course from PyTorch, but also things like Prophet, a time series library, and then there's Tianqi. 888 | 当然还有Facebook,来自PyTorch,但也有像Prophet这样的时间序列库,然后还有天奇。 889 | 890 | 180 891 | 00:32:58,980 --> 00:33:12,543 892 | So Tianqi has been, he was the original developer of XGBoost, one of the most frequently used libraries for gradient boosting and still one of the most widely used libraries for tabular data. 893 | 天奇一直是XGBoost的原始开发者之一,这是最常用的梯度提升库之一,仍然是最广泛使用的表格数据库之一。 894 | 895 | 181 896 | 00:33:13,440 --> 00:33:19,470 897 | He was a lead developer for the MXNet library, which was another deep learning framework like PyTorch and TensorFlow. 898 | 他曾是MXNet库的首席开发人员,这是另一个类似于PyTorch和TensorFlow的深度学习框架。 899 | 900 | 182 901 | 00:33:19,470 --> 00:33:25,140 902 | And then most recently, one of the founding developers and core developers of the Apache TVM library. 903 | 最近,他是Apache TVM库的创始开发人员和核心开发人员之一。 904 | 905 | 183 906 | 00:33:25,140 --> 00:33:35,430 907 | And so he has done kind of an amazing number of things in machine learning systems as a whole, and actually quite excited to be able to teach this course with him. 908 | 因此,他在机器学习系统方面做了很多惊人的事情,我非常兴奋能够和他一起教授这门课程。 909 | 910 | 184 911 | 00:33:36,960 --> 00:33:47,880 912 | So before now I jump into the details of this course and these lectures, I want to offer a big disclaimer, which I think needs to be said here. 913 | 在我深入介绍这门课程和这些讲座的细节之前,我想提供一个重要的免责声明,我认为这需要在这里说一下。 914 | 915 | 185 916 | 00:33:47,880 --> 00:33:53,420 917 | And what I'm saying here is that we are offering this course online for the first time. 918 | 我要说的是,我们首次在线上提供这门课程。 919 | 920 | 186 921 | 00:33:53,420 --> 00:34:05,550 922 | 现在,课程网站dlsyscourse.org上有所有这些信息,并将列出和发布课程的所有讲座。 923 | 我们以前没有这样做过,而且许多材料,特别是作业,这是这门课程最复杂的部分,正在重新制定。 924 | 925 | 187 926 | 00:34:05,550 --> 00:34:14,130 927 | Actually being revamped, even for the CMU version and then that will be they're kind of beta testing this, and then you'll be given the assignments soon after that. 928 | 实际上,即使是对于CMU版本,也正在进行重新制定,然后他们将进行测试,然后您将很快获得作业。 929 | 930 | 188 931 | 00:34:14,130 --> 00:34:36,990 932 | But as par for the course here, there are, no pun intended, but as par for the course, there are going to be bugs in the content and the assignments, or just in the logistics of how we run things, right? This is the first time we're offering this as an online course, there are going to be bugs, there are going to be hiccups, please bear with us. 933 | 但是,按照惯例,内容和作业中会有错误,或者在我们运行事物的逻辑方面会有错误,对吧?这是我们首次在线上提供这门课程,会有错误,会有小问题,请耐心等待。 934 | 935 | 189 936 | 00:34:36,990 --> 00:34:46,950 937 | There's a saying that you get what you pay for, right? And this course is free, it's free because we want people to be taking it and want this material to be out there. 938 | 有一句话说得好,你得到你所付出的,对吧?这门课程是免费的,我们希望人们参加并且想让这些材料出现。 939 | 940 | 190 941 | 00:34:46,950 --> 00:34:53,430 942 | But we are doing this ourselves and we are putting it together ourselves and there will be bugs in it. 943 | 但是我们自己在做这件事,我们自己在组织这个课程,其中会有错误。 944 | 945 | 191 946 | 00:34:53,430 --> 00:35:09,914 947 | So we apologize kind of ahead of time for this, please bear with us, we will do our best to fix these things and extend deadlines as needed to account for these bugs, but they will be there, and we appreciate, you are all beta testers for this course as we create it. 948 | 因此,我们提前为此道歉,请耐心等待,我们将尽力修复这些问题并根据需要延长截止日期以解决这些问题,但是它们将存在,我们感谢您作为我们创建这门课程的测试人员之一。 949 | 950 | 192 951 | 00:35:09,914 --> 00:35:17,523 952 | So part of the fun of taking an online course for the first time is that you become a beta tester for the course. 953 | 因此,首次参加在线课程的乐趣之一是成为课程的测试人员。 954 | 955 | 193 956 | 00:35:19,050 --> 00:35:31,143 957 | All right, now learning objectives, what are you gonna learn in this course? I've probably made this clear from past slides, but let me lay it out just in very, hopefully clear terms here. 958 | 好了,现在是学习目标,你将在这门课程中学到什么?我可能已经在过去的幻灯片中表明了这一点,但是让我在这里以非常清晰的方式阐述一下。 959 | 960 | 194 961 | 00:35:32,430 --> 00:35:36,630 962 | If you stay through this whole course, do all the assignments and do a final project. 963 | 如果你完成整个课程,完成所有作业并完成一个最终项目。 964 | 965 | 195 966 | 00:35:36,630 --> 00:35:48,630 967 | Then by the end of this course, you will understand the basic functioning of modern, deep learning libraries, including concepts like automatic differentiation and grade based optimization from an algorithmic standpoint. 968 | 那么在课程结束时,你将从算法的角度理解现代深度学习库的基本功能,包括自动微分和基于梯度的优化等概念。 969 | 970 | 196 971 | 00:35:49,830 --> 00:36:14,313 972 | You will be able to implement really from scratch, right, because we're talking about implementing these without PyTorch or without TensorFlow behind you, but just really, just from raw Python, you'll be able to implement several standard deep learning architectures, things like MLPs, ConvNets, RNNs or LSTMs, various kinds of RNNs, and then transformers, and do it truly from scratch. 973 | 你将能够真正从头开始实现几个标准的深度学习架构,例如MLP、ConvNets、RNN或LSTMs、各种类型的RNN和transformers,而且完全不需要PyTorch或TensorFlow的支持,只需使用原始的Python代码即可实现。 974 | 975 | 197 976 | 00:36:15,450 --> 00:36:26,373 977 | And you will also understand and implement how hardware acceleration works under the hood and be able to develop your own highly efficient code. 978 | 你还将理解并实现硬件加速的工作原理,并能够开发自己的高效代码。 979 | 980 | 198 981 | 00:36:28,830 --> 00:36:36,840 982 | Now it's not going to be, I should emphasize it's not going to be nearly as efficient as libraries like PyTorch or TensorFlow. 983 | 现在需要强调的是,这些代码的效率远不如PyTorch或TensorFlow等库。 984 | 985 | 199 986 | 00:36:36,840 --> 00:36:45,090 987 | There's still a big gap between the very best that optimization can do and that the code optimization can do, I should emphasize. 988 | 优化的最佳效果与代码优化的最佳效果之间仍然存在很大差距。 989 | 990 | 200 991 | 00:36:45,090 --> 00:36:49,710 992 | And what you can do with 2000 lines of code, no question. 993 | 但你可以用2000行代码做到很多事情。 994 | 995 | 201 996 | 00:36:49,710 --> 00:37:14,313 997 | So we're not gonna break any speed records here, but you will be able to create libraries that work on reasonable, medium sized data, data like CIFAR, right, reasonably sized networks and architectures, you'll be able to develop them, write medium size architectures that actually work for these systems and do it entirely from scratch on GPU with automatic differentiation, with nice optimizers, all that. 998 | 因此,我们不会创造任何速度记录,但你将能够创建适用于合理的、中等规模的数据,例如CIFAR等数据集的库,编写适用于这些系统的中等规模的网络和架构,并完全在GPU上使用自动微分、优化器等实现。 999 | 1000 | 202 1001 | 00:37:15,870 --> 00:37:30,060 1002 | Now the course website, which is dlsyscourse.org, has all this information and will have a listing and also posting of all the lectures for the course. 1003 | 1004 | 203 1005 | 00:37:30,060 --> 00:37:34,680 1006 | And you can look at the schedule of topics to see what you'll be learning there. 1007 | 你可以查看主题的时间表,了解你将学习的内容。 1008 | 1009 | 204 1010 | 00:37:34,680 --> 00:37:44,970 1011 | Now, one thing to emphasize is that that schedule, at least the schedule here that I'm listing is the schedule for the CMU version, which is about two weeks ahead of the online version. 1012 | 需要强调的一点是,至少我列出的这个时间表是CMU版本的时间表,比在线版本提前两周。 1013 | 1014 | 205 1015 | 00:37:44,970 --> 00:37:55,320 1016 | But we will also post the dates and the videos for all the online lectures as they become available and it will follow the same structure as the main CMU course. 1017 | 但我们也会发布所有在线讲座的日期和视频,其结构与主要的CMU课程相同。 1018 | 1019 | 206 1020 | 00:37:55,320 --> 00:38:03,480 1021 | Actually only this lecture has slightly different slides because there's different logistics for the online course versus the CMU course. 1022 | 实际上,只有这个讲座的幻灯片稍微有些不同,因为在线课程和CMU课程的物流不同。 1023 | 1024 | 207 1025 | 00:38:03,480 --> 00:38:13,920 1026 | But the rest of the schedule will follow the same schedule between the CMU version of the course and the online course and the schedule is up on the website. 1027 | 但是,除此之外,CMU版本的课程和在线课程的其余日程安排将遵循相同的日程安排,并且日程安排已经发布在网站上。 1028 | 1029 | 208 1030 | 00:38:13,920 --> 00:38:24,090 1031 | It talks about things like covering an ML refresher and background, automatic differentiation, different types of architectures, et cetera. 1032 | 它涵盖了诸如机器学习复习和背景、自动微分、不同类型的架构等内容。 1033 | 1034 | 209 1035 | 00:38:24,090 --> 00:38:55,863 1036 | Now one thing you will see is a lot of the lectures are broken down between algorithm lectures, so lectures covering kind of the methodological algorithms or techniques used to solve some or to accomplish some task in deep learning, and then implementation lectures where we will actually implement some portions of this or walk you through some simple live coding of how these things actually are done in practice. 1037 | 现在你会看到很多讲座都被分成了算法讲座和实现讲座,算法讲座涵盖了用于解决深度学习中某些任务或实现某些任务的方法论算法或技术,而实现讲座则会实际实现其中的一些部分或向你演示这些东西在实践中是如何完成的。 1038 | 1039 | 210 1040 | 00:38:57,840 --> 00:39:14,310 1041 | Now in order to take this course, what should you know ahead of time? And to be honest about this, there is some reasonable prerequisites you should have here in order to get the most out of this course. 1042 | 现在,为了参加这门课程,你需要提前了解些什么?说实话,你应该具备一些合理的先决条件,以便从这门课程中获得最大的收益。 1043 | 1044 | 211 1045 | 00:39:14,310 --> 00:39:19,020 1046 | Now it's not to say that if you don't have all these things, the course is impossible. 1047 | 现在并不是说如果你没有所有这些东西,这门课程就不可能了。 1048 | 1049 | 212 1050 | 00:39:19,020 --> 00:39:29,110 1051 | If you're really excited about it and want to learn some of these things concurrently as you go through the course, you are welcome to, just know that it will be more effort to do so. 1052 | 如果你真的对此感到兴奋,并想在学习这些东西的同时学习这些东西,那么你是受欢迎的,只要知道这需要更多的努力。 1053 | 1054 | 213 1055 | 00:39:30,030 --> 00:39:33,270 1056 | But to take this course, you should have some background in systems programming. 1057 | 但是,要参加这门课程,你应该具备一些系统编程的背景。 1058 | 1059 | 214 1060 | 00:39:33,270 --> 00:39:51,243 1061 | That means basically C++ coding, how to compile things, how to compile things like, not just run Python scripts, but actually compile executable code that sort of runs on natively on hardware. 1062 | 这基本上意味着C++编码,如何编译东西,如何编译像本地硬件上运行的可执行代码,而不仅仅是运行Python脚本。 1063 | 1064 | 215 1065 | 00:39:53,310 --> 00:39:59,880 1066 | Linear algebra, so you should be familiar with vector and matrix notation. 1067 | 线性代数,所以你应该熟悉向量和矩阵符号。 1068 | 1069 | 216 1070 | 00:39:59,880 --> 00:40:10,740 1071 | So there's no math, I mentioned in this lecture, but later lectures will actually require, I will write things like a bunch of matrices and vectors multiply it against each other. 1072 | 所以在这个讲座中没有数学,但是后面的讲座实际上需要,我会写一些矩阵和向量相乘的东西。 1073 | 1074 | 217 1075 | 00:40:10,740 --> 00:40:16,383 1076 | I will do things like take gradients or derivatives of these things and you should know what that means. 1077 | 我会做一些类似于对这些东西进行梯度或导数的操作,你应该知道这意味着什么。 1078 | 1079 | 218 1080 | 00:40:18,330 --> 00:40:29,610 1081 | That means also, and probably the biggest requirement really is linear algebra, but there's other things too, like calculus, really, to be clear, just taking derivatives. 1082 | 这也意味着,可能最大的要求就是线性代数,但还有其他的东西,比如微积分,确切地说,只是求导数。 1083 | 1084 | 219 1085 | 00:40:29,610 --> 00:40:37,443 1086 | We don't really do any integrals, there's some integrals in probability, I guess, but we don't do many integrals in deep learning. 1087 | 我们实际上并不做任何积分,可能在概率中会有一些积分,但在深度学习中我们并不做很多积分。 1088 | 1089 | 220 1090 | 00:40:38,340 --> 00:40:45,120 1091 | But you should know when I write things like gradient symbols and stuff like that, you should know what these things mean or have some understanding of it. 1092 | 但是,当我写梯度符号之类的东西时,你应该知道这些东西的含义或者对它们有一些了解。 1093 | 1094 | 221 1095 | 00:40:45,120 --> 00:40:54,840 1096 | We can provide some links to refreshers or background material on this, but if this is really brand new to you, this could be somewhat challenging to become familiar with. 1097 | 我们可以提供一些关于这方面的复习或背景材料的链接,但如果这对你来说是全新的,那么熟悉它可能会有些具有挑战性。 1098 | 1099 | 222 1100 | 00:40:54,840 --> 00:41:07,290 1101 | As well as sort of basic proofs, now we're not gonna do many proofs in this course to be very clear, this is really a systems course, but you should be familiar with sort of the basic constructs of how you go about deriving things mathematically. 1102 | 还有一些基本的证明,我们在这门课程中不会做很多证明,这实际上是一门系统课程,但你应该熟悉如何在数学上推导基本结构。 1103 | 1104 | 223 1105 | 00:41:07,290 --> 00:41:36,270 1106 | How do you derive a gradient and stuff like this? You need some Python and C++ development background and a common question that's asked, is how much C++ background do you need? The answer is, I don't think that much, we're not using any advanced features of C++ or anything, we're not even using, certainly not C++20 and not even C++11 or anything like that. 1107 | 如何推导梯度等等?你需要一些Python和C++开发背景,一个常见的问题是你需要多少C++背景?答案是,我认为不需要太多,我们没有使用任何高级的C++特性或任何东西,我们甚至没有使用C++20,当然也没有使用C++11或任何类似的东西。 1108 | 1109 | 224 1110 | 00:41:36,270 --> 00:41:39,540 1111 | I don't even know if that's the right year to be honest. 1112 | 说实话,我甚至不知道那是不是正确的年份。 1113 | 1114 | 225 1115 | 00:41:39,540 --> 00:41:42,750 1116 | I don't know those things very well, we're not using unique pointers or anything like that. 1117 | 我不太了解这些东西,我们没有使用unique pointers或任何类似的东西。 1118 | 1119 | 226 1120 | 00:41:42,750 --> 00:41:46,770 1121 | It's really just C with a few classes in addition. 1122 | 实际上只是C语言加上一些类。 1123 | 1124 | 227 1125 | 00:41:46,770 --> 00:42:06,600 1126 | So I see this as actually very minimal C++ experience, but what you should know how to do is if we give you a template for writing a matrix multiplication call in C++, so this template would take in a bunch of float pointers and const float pointers and stuff like that. 1127 | 所以我认为这实际上是非常少的C++经验,但你应该知道如何使用我们为你提供的C++矩阵乘法调用模板,这个模板会接受一堆浮点指针和const浮点指针等等。 1128 | 1129 | 228 1130 | 00:42:06,600 --> 00:42:24,510 1131 | The sizes of these matrices, things like this, where those pointers point to the raw underlying data in the in the matrices, you should know how to write quickly a matrix multiplication routine that would multiply these two matrices together. 1132 | 这些矩阵的大小,这些指针指向矩阵中的原始底层数据,你应该知道如何快速编写一个矩阵乘法例程,将这两个矩阵相乘。 1133 | 1134 | 229 1135 | 00:42:24,510 --> 00:42:45,030 1136 | And then most importantly, because this will happen, when you mess up your indexing in C++ because there's no safe indexing there and you have a segfault of your program, you should know how to debug it, either through a debugger, or if you're like me, then through at least, the very least through printf statements that, this is how I debug honestly, C++ code. 1137 | 最重要的是,因为这将会发生,当你在C++中弄错索引时,因为那里没有安全的索引,你的程序会出现段错误,你应该知道如何调试它,无论是通过调试器,还是像我一样,至少通过printf语句来调试C++代码。 1138 | 1139 | 230 1140 | 00:42:45,030 --> 00:42:53,400 1141 | But you should know how to fix things when your code segfaults, right? So that's kind of the level of C++ background you need. 1142 | 但是你应该知道当你的代码出现段错误时如何修复,对吧?所以这就是你需要的C++背景水平。 1143 | 1144 | 231 1145 | 00:42:53,400 --> 00:43:04,440 1146 | Python, you should probably be familiar with classes and such in Python too, because you will be implementing most of the structure of this library in Python and that you have to be familiar with. 1147 | 对于Python,你应该熟悉Python中的类和其他一些内容,因为你将在Python中实现这个库的大部分结构,你需要熟悉这些。 1148 | 1149 | 232 1150 | 00:43:04,440 --> 00:43:07,650 1151 | But C++ is really sort of for the low level background. 1152 | 但是C++确实是用于低级背景的。 1153 | 1154 | 233 1155 | 00:43:07,650 --> 00:43:14,403 1156 | You don't need to know CUDA programming ahead of time, we will cover what you need to know for the course, but you need to understand basic C++ programming. 1157 | 你不需要提前了解CUDA编程,我们会在课程中涵盖你需要了解的内容,但你需要理解基本的C++编程。 1158 | 1159 | 234 1160 | 00:43:15,390 --> 00:43:19,116 1161 | And then finally you do need to have prior experience with machine learning. 1162 | 最后,你确实需要有机器学习的先前经验。 1163 | 1164 | 235 1165 | 00:43:19,116 --> 00:43:27,570 1166 | If all of this, if machine learning is really new to you, you're much better off taking a machine learning course first and then taking this course afterwards. 1167 | 如果机器学习对你来说真的很新,那么最好先参加一门机器学习课程,然后再参加这门课程。 1168 | 1169 | 236 1170 | 00:43:27,570 --> 00:43:39,513 1171 | You will get much, much more out of this if you're already familiar with machine learning and probably already familiar with deep learning, to a large degree and then take this course to understand more how these things actually work. 1172 | 如果你已经熟悉机器学习,并且可能已经熟悉深度学习,那么参加这门课程可以更好地了解这些东西的实际工作原理。 1173 | 1174 | 237 1175 | 00:43:41,010 --> 00:43:58,053 1176 | So if you are unsure about your background, then what I would say is, take a look at the first three lectures, I guess not including this one, the next three, and look at homework zero, which is gonna be released two days after we release, we officially start the class. 1177 | 所以,如果你对自己的背景不确定,那么我建议你看一下前三节课,不包括这一节,接下来的三节课,并查看作业零,这将在我们正式开始课程两天后发布。 1178 | 1179 | 238 1180 | 00:43:59,580 --> 00:44:07,590 1181 | This homework zero is essentially meant to be a refresher on some basic ideas of traditional ways of writing things. 1182 | 这个作业零基本上是关于传统写作方式的一些基本思想的复习。 1183 | 1184 | 239 1185 | 00:44:07,590 --> 00:44:12,630 1186 | Basically you will implement softmax regression and a simple two layer neural network. 1187 | 基本上,你将实现softmax回归和一个简单的两层神经网络。 1188 | 1189 | 240 1190 | 00:44:12,630 --> 00:44:30,230 1191 | And you should be familiar with how, neural network in using kind of manual backprop and you should be familiar with that, you should have seen this before and maybe with a bit of refresher, be able to do that relatively quickly to know this course is right for you. 1192 | 你应该熟悉如何使用手动反向传播的神经网络,你应该之前见过这个,并且通过一些复习,能够相对快速地完成,以确定这门课程是否适合你。 1193 | 1194 | 241 1195 | 00:44:31,711 --> 00:44:36,600 1196 | And one of these, you actually will also write C with a C++ backend. 1197 | 其中一个,你实际上也会使用C++后端编写C。 1198 | 1199 | 242 1200 | 00:44:36,600 --> 00:44:42,330 1201 | But if that is very challenging for you, then probably should take some other material before you take this course. 1202 | 但是如果这对你来说非常具有挑战性,那么可能应该在参加这门课程之前先学习其他材料。 1203 | 1204 | 243 1205 | 00:44:42,330 --> 00:44:52,953 1206 | But if all those things are pretty straightforward or really can be made more straightforward again, if you brush up a little bit, then this course is likely the right level for you. 1207 | 但是如果所有这些事情都相当简单,或者通过一些复习可以变得更简单,那么这门课程可能是适合你的水平。 1208 | 1209 | 244 1210 | 00:44:54,600 --> 00:45:08,790 1211 | Now there are four main elements to this course, the video lectures of which you are watching the first one, programming based homeworks, a final project done in groups and interaction in the course forum. 1212 | 现在,这门课程有四个主要元素,你正在观看第一个元素的视频讲座,包括基于编程的作业、小组完成的最终项目和在课程论坛中的互动。 1213 | 1214 | 245 1215 | 00:45:08,790 --> 00:45:12,810 1216 | And it's important to take part in all of these in order to get the full value of the course. 1217 | 参与所有这些元素非常重要,才能充分获得课程的价值。 1218 | 1219 | 246 1220 | 00:45:12,810 --> 00:45:20,430 1221 | I really think that each of these components plays a crucial, crucial role in really understanding the material. 1222 | 我真的认为每个组成部分都在真正理解材料方面发挥了至关重要的作用。 1223 | 1224 | 247 1225 | 00:45:20,430 --> 00:45:25,140 1226 | Even if, for example, lectures are not directly using the homework, they're still very important to know. 1227 | 即使,例如,讲座没有直接使用作业,它们仍然非常重要。 1228 | 1229 | 248 1230 | 00:45:25,140 --> 00:45:36,820 1231 | And even if the forum is in some sense, optional, it's very valuable to get interaction with other students taking the course in order to get the most out of it possible. 1232 | 即使论坛在某种意义上是可选的,与其他学生互动以获得尽可能多的收益非常有价值。 1233 | 1234 | 249 1235 | 00:45:38,880 --> 00:45:45,030 1236 | I do want to emphasize that this online public course is offered really independently of the CMU version. 1237 | 我想强调的是,这个在线公开课程是独立于CMU版本提供的。 1238 | 1239 | 250 1240 | 00:45:45,030 --> 00:45:53,280 1241 | So we can't offer CMU credit or things like this for taking this course, even if you pass and do well on the course. 1242 | 因此,即使你通过并在课程上表现良好,我们也不能提供CMU学分或类似的东西。 1243 | 1244 | 251 1245 | 00:45:53,280 --> 00:46:07,740 1246 | But what we will do is for everyone in the course who completes the assignments, gets an average of 80% or higher and submits a final project, you'll receive a certificate of completion for the course to sort of indicate you've completed it. 1247 | 但是,对于完成作业,平均分达到80%或更高并提交最终项目的课程中的每个人,您将获得一张完成课程的证书,以表明您已经完成了它。 1248 | 1249 | 252 1250 | 00:46:07,740 --> 00:46:13,290 1251 | We'll somehow make it official, probably post it on the website or something so you can have an official link to it and things like that. 1252 | 我们会将其正式化,可能会在网站上发布,以便您可以获得官方链接等。 1253 | 1254 | 253 1255 | 00:46:13,290 --> 00:46:26,850 1256 | But you will receive a certificate of completion personalized to you that in some sense, certifies you've taken and completed this course, even in online, even just, in some sense in the online public version. 1257 | 但是,您将收到一张个性化的完成证书,以某种方式证明您已经参加并成功完成了这门课程,即使只是在在线公开版本中。 1258 | 1259 | 254 1260 | 00:46:26,850 --> 00:46:35,553 1261 | Because it is a lot of effort and we do want to ensure that you have something to show and some sort of record that you've completed this and done it successfully. 1262 | 因为这需要很多努力,我们确实希望您有一些可以展示和证明您已经成功完成了它的记录。 1263 | 1264 | 255 1265 | 00:46:37,020 --> 00:46:44,490 1266 | Now I'll end by just describing each of these a little bit in each of these four elements in a bit more detail here. 1267 | 现在,我将简要描述这四个元素中的每一个。 1268 | 1269 | 256 1270 | 00:46:44,490 --> 00:46:48,990 1271 | So the video lectures themselves are going to be essentially in the format you're watching right now. 1272 | 因此,视频讲座本身将基本上采用您正在观看的格式。 1273 | 1274 | 257 1275 | 00:46:48,990 --> 00:46:58,047 1276 | So they will be live recordings of the lecture, they will consist of slide presentations like this one. 1277 | 因此,它们将是讲座的实时录音,包括像这样的幻灯片演示。 1278 | 1279 | 258 1280 | 00:46:58,047 --> 00:47:02,610 1281 | But most won't just be this, I think this is the only lecture that is just nothing but slides. 1282 | 但大多数不会只是这样,我认为这是唯一一堂只有幻灯片的讲座。 1283 | 1284 | 259 1285 | 00:47:02,610 --> 00:47:16,290 1286 | The rest will all also have things like mathematical notes to them, derivations and in many cases live coding to illustrate some ideas, okay? Videos for all the intellectuals will be posted to YouTube or other video sites. 1287 | 其余的都会有数学笔记、推导和许多情况下的实时编码来说明一些想法,好吗?所有智力人士的视频都将发布到YouTube或其他视频网站。 1288 | 1289 | 260 1290 | 00:47:16,290 --> 00:47:22,650 1291 | We're gonna try to make them available on a few different video sites so that they can be accessed globally according to the course schedule. 1292 | 我们将尝试将它们发布到几个不同的视频网站,以便根据课程时间表全球访问。 1293 | 1294 | 261 1295 | 00:47:22,650 --> 00:47:27,960 1296 | And videos will be available to everyone, so because they're on YouTube anyone can watch them. 1297 | 视频将对所有人开放,因此因为它们在YouTube上,任何人都可以观看它们。 1298 | 1299 | 262 1300 | 00:47:27,960 --> 00:47:34,760 1301 | So you can actually watch without officially enrolling in the course, many of you probably are watching without officially enrolling in the course. 1302 | 因此,您实际上可以在不正式注册课程的情况下观看,您们中的许多人可能正在观看而没有正式注册课程。 1303 | 1304 | 263 1305 | 00:47:35,850 --> 00:47:37,920 1306 | They don't require registering for the course. 1307 | 它们不需要注册课程。 1308 | 1309 | 264 1310 | 00:47:37,920 --> 00:47:45,750 1311 | One thing I will mention, which you can probably tell from this, if you've made it this far through the lecture so far, is that these lectures are taken in one take. 1312 | 我要提到的一件事是,如果您已经通过本讲座到达了这个地方,您可能已经知道,这些讲座是一次性的。 1313 | 1314 | 265 1315 | 00:47:45,750 --> 00:47:48,450 1316 | We're not doing a lot of editing here. 1317 | 我们在这里没有做很多编辑。 1318 | 1319 | 266 1320 | 00:47:48,450 --> 00:48:01,613 1321 | Essentially, we are recording these live and we will with minimal can be cutting at the beginning at the end or if something really goes bad cropping in the middle, we're mostly gonna do these in one take and with all the hiccups and such that happen in a real lecture. 1322 | 基本上,我们正在现场录制这些内容,我们将在开头和结尾进行最小的剪辑,或者如果某些事情真的很糟糕,我们会在中间进行裁剪,我们大多数情况下会一次性完成这些内容,并且会有所有在真实讲座中发生的小问题。 1323 | 1324 | 267 1325 | 00:48:01,613 --> 00:48:09,333 1326 | So this is sort of a online version, but still kind of live stream, think of them as live streams of lectures. 1327 | 因此,这是一种在线版本,但仍然是一种直播,将它们视为讲座的直播。 1328 | 1329 | 268 1330 | 00:48:11,340 --> 00:48:14,220 1331 | The second component that I mentioned was programming assignments. 1332 | 我提到的第二个组成部分是编程作业。 1333 | 1334 | 269 1335 | 00:48:14,220 --> 00:48:18,960 1336 | And this is actually, if I was to say, this is probably the most important component of the class. 1337 | 实际上,如果我要说,这可能是课程中最重要的组成部分。 1338 | 1339 | 270 1340 | 00:48:18,960 --> 00:48:43,413 1341 | So in addition to homework zero, which is kind of a separate thing in and of itself, there are four homeworks, homeworks one through four, and these four homeworks take you through the process of building different aspects of this needle library, this minimal Python, deep learning framework. 1342 | 除了零作业之外,这是一个独立的东西,还有四个作业,作业一到四,这四个作业将带您完成构建这个needle库的不同方面的过程,这个最小的Python深度学习框架。 1343 | 1344 | 271 1345 | 00:48:44,340 --> 00:48:50,790 1346 | And in particular, you're going to first develop an automatic differentiation framework for needle. 1347 | 特别是,您将首先为needle开发自动微分框架。 1348 | 1349 | 272 1350 | 00:48:50,790 --> 00:49:02,040 1351 | Then you will use this to build a simple neural network library with things like modules for neural networks, optimization techniques, data loading, that kind of stuff. 1352 | 然后,您将使用此框架构建一个简单的神经网络库,其中包括神经网络模块、优化技术、数据加载等模块。 1353 | 1354 | 273 1355 | 00:49:02,040 --> 00:49:09,120 1356 | You will then implement linear algebra backends on both CPUs and GPU systems. 1357 | 然后,您将在CPU和GPU系统上实现线性代数后端。 1358 | 1359 | 274 1360 | 00:49:09,120 --> 00:49:20,883 1361 | And finally, you'll use these things implement a number of, in the fourth assignment, a number of common architectures like combination networks recurrent networks and possibly Transformers. 1362 | 最后,在第四个任务中,您将使用这些东西实现许多常见的架构,如组合网络、循环网络和可能的Transformer。 1363 | 1364 | 275 1365 | 00:49:22,890 --> 00:49:33,750 1366 | Each of these assignments builds on previous ones and you actually have to complete them in order, you have to complete the first assignment before you can do later ones because they build on each other. 1367 | 每个任务都建立在前面的任务之上,您必须按顺序完成它们,必须先完成第一个任务,然后才能完成后面的任务,因为它们相互依赖。 1368 | 1369 | 276 1370 | 00:49:33,750 --> 00:49:44,640 1371 | And this process of building this library really is the key component of the course and it is how you will learn the most through it. 1372 | 构建这个库的过程实际上是课程的关键组成部分,也是您通过它学习最多的方式。 1373 | 1374 | 277 1375 | 00:49:44,640 --> 00:49:58,350 1376 | So anyone can watch the lecture videos, but in order to submit the assignments, you do need to officially sign up for the course. 1377 | 因此,任何人都可以观看讲座视频,但是为了提交作业,您需要正式注册课程。 1378 | 1379 | 278 1380 | 00:49:58,350 --> 00:50:14,223 1381 | So you have to actually register for the course, so if you're watching this video just on YouTube and have not signed up for the course yet, if you want to submit the assignments, which is really the way you learn this material, then you sign up for the course and you will get an account to submit assignments to our auto grading setup. 1382 | 因此,您必须实际注册课程,因此,如果您只是在YouTube上观看此视频并且尚未注册课程,则如果您想提交作业(这确实是您学习此材料的方式),则注册课程,您将获得一个帐户,以向我们的自动评分设置提交作业。 1383 | 1384 | 279 1385 | 00:50:15,450 --> 00:50:20,853 1386 | Now one thing I want to mention is that the homeworks are entirely coding based. 1387 | 现在,我想提到的一件事是,作业完全基于编码。 1388 | 1389 | 280 1390 | 00:50:21,690 --> 00:50:30,600 1391 | There's no derivations, nothing like this in the homeworks or whatever derivation we have, it's sort of implicit because then you have to code it up afterwards, to know if it actually works or not. 1392 | 作业中没有推导,也没有任何推导,因为之后您必须将其编码,以了解它是否实际有效。 1393 | 1394 | 281 1395 | 00:50:30,600 --> 00:50:33,870 1396 | The homeworks are entirely coding based and they're all auto graded. 1397 | 作业完全基于编码,全部自动评分。 1398 | 1399 | 282 1400 | 00:50:33,870 --> 00:50:35,550 1401 | This is actually true for the CNU version too. 1402 | 这在CNU版本中也是完全相同的。 1403 | 1404 | 283 1405 | 00:50:35,550 --> 00:50:37,650 1406 | This is the exact same in the CNU version of the course. 1407 | 这在CNU版本中也是完全相同的。 1408 | 1409 | 284 1410 | 00:50:37,650 --> 00:50:44,280 1411 | Everything, there's no theory questions on the homework, it is just programming assignments, all code based. 1412 | 作业中没有理论问题,只有编程作业,全部基于代码。 1413 | 1414 | 285 1415 | 00:50:44,280 --> 00:50:51,393 1416 | And it's graded through our own auto grading system that I've actually been developing for a few years. 1417 | 它通过我们自己的自动评分系统进行评分,我实际上已经开发了几年。 1418 | 1419 | 286 1420 | 00:50:52,860 --> 00:51:08,283 1421 | And this auto grading system works a bit differently from others you may have seen, I'll document this a lot in a future lecture, actually a separate video about the auto grading system I'll post soon after this one. 1422 | 这个自动评分系统与您可能见过的其他系统有些不同,我将在未来的讲座中详细记录这一点,实际上是关于自动评分系统的单独视频,我将在此视频之后不久发布。 1423 | 1424 | 287 1425 | 00:51:09,330 --> 00:51:12,570 1426 | I'll run to the process of submitting code to this auto grader. 1427 | 我将介绍提交代码到这个自动评分器的过程。 1428 | 1429 | 288 1430 | 00:51:12,570 --> 00:51:28,410 1431 | But the big difference that I'll just highlight right now is that in this auto grader, you actually run all your code locally rather than submitting your code and having it run on the auto grader which causes all sorts of problems because the environment in the auto grader is never the same as the one you've coded on locally. 1432 | 但是我现在要强调的一个重大区别是,在这个自动评分系统中,你实际上是在本地运行所有的代码,而不是提交你的代码并让它在自动评分系统上运行,这会导致各种各样的问题,因为自动评分系统中的环境永远不会与你本地编写的环境相同。 1433 | 1434 | 289 1435 | 00:51:28,410 --> 00:51:32,310 1436 | So you actually run all your execution locally and you only submit answers. 1437 | 所以你实际上是在本地运行所有的执行,只提交答案。 1438 | 1439 | 290 1440 | 00:51:32,310 --> 00:51:44,790 1441 | So the answers and check against reference solutions in the auto grading system, which makes it much more efficient, much faster to run as well as sort of makes it a little bit less painful in terms of debugging environment setups. 1442 | 因此,答案会与自动评分系统中的参考解决方案进行比较,这使得它更加高效,运行速度更快,同时在调试环境设置方面也会少一些痛苦。 1443 | 1444 | 291 1445 | 00:51:44,790 --> 00:51:49,710 1446 | So I'll go through all that in a second in later lecture. 1447 | 我会在稍后的讲座中详细介绍所有这些内容。 1448 | 1449 | 292 1450 | 00:51:49,710 --> 00:51:57,540 1451 | It also means that essentially running in Colab environments, at least currently, I know Colab's changing monthly, so we may run into some issues, hiccups with Colab. 1452 | 1453 | 293 1454 | 00:51:57,540 --> 00:52:06,570 1455 | But at least currently you can do all the assignments in Colab and submit them, execute them all in Colab and do all the auto grading and use that. 1456 | 但至少目前是可以的,你可以在Colab中完成所有的作业并提交它们,执行所有的自动评分并使用它。 1457 | 1458 | 294 1459 | 00:52:06,570 --> 00:52:14,850 1460 | And as I said, I will go through that, the setup and at least the desired workflow for how you should do assignments. 1461 | 正如我所说的,我将在另一个视频中介绍设置和至少应该如何完成作业的期望工作流程。 1462 | 1463 | 295 1464 | 00:52:14,850 --> 00:52:23,043 1465 | I'll go through that in a separate video in a few, probably posted actually concurrently with this one, but in a few more in a days. 1466 | 我会在几天内发布一个单独的视频,可能与这个视频同时发布。 1467 | 1468 | 296 1469 | 00:52:25,230 --> 00:52:28,770 1470 | All right, the second to last component is the final project. 1471 | 好的,倒数第二个组成部分是期末项目。 1472 | 1473 | 297 1474 | 00:52:28,770 --> 00:52:39,270 1475 | So in addition to homeworks, there will be a final project and unlike the homeworks, which are to be done individually, the final project should be done in groups. 1476 | 除了作业外,还将有一个期末项目,与个人完成的作业不同,期末项目应该是小组完成的。 1477 | 1478 | 298 1479 | 00:52:39,270 --> 00:52:54,330 1480 | So you will form groups, there will be posting on the forums to form groups as the time comes then in groups of three, especially for the online course, if you wanna find a group of one, or if you find bigger groups that's certainly fine the point is to form a group and do a final project. 1481 | 你们会组成小组,在论坛上发布组队信息,然后以三人小组的形式进行,特别是对于在线课程,如果你想找到一个人的小组,或者如果你找到更大的小组,那当然也可以,重点是要组成一个小组并完成一个期末项目。 1482 | 1483 | 299 1484 | 00:52:54,330 --> 00:53:00,450 1485 | And the idea here is the final project involves developing some new piece of functionality for needle. 1486 | 1487 | 300 1488 | 00:53:00,450 --> 00:53:09,300 1489 | So it's kind of homework five, designing homework five, right? Well, to be clear, it's homework zero and homework four, the homework so you're the final project is like homework five. 1490 | 所以它有点像作业五的设计,对吧?嗯,要明确的是,它是作业零和作业四,作业,所以你的期末项目就像作业五。 1491 | 1492 | 301 1493 | 00:53:09,300 --> 00:53:16,170 1494 | You develop some new functionality capability to the needle framework. 1495 | 你需要开发一些新的功能能力到needle框架中。 1496 | 1497 | 302 1498 | 00:53:16,170 --> 00:53:26,400 1499 | It's really important though, that this final project involves some kind of extension to needle, not just implementing some architecture and certainly not just implementing an architecture in PyTorch or TensorFlow. 1500 | 但是非常重要的是,这个最终项目必须涉及到对needle的扩展,而不仅仅是实现一些架构,当然也不是在PyTorch或TensorFlow中实现架构。 1501 | 1502 | 303 1503 | 00:53:26,400 --> 00:53:35,823 1504 | You can't just do that as a final project, it really has to be an extension of the needle library, add a different kind of hardware acceleration to the back end. 1505 | 你不能只做这个作为最终项目,它必须是needle库的扩展,向后端添加不同种类的硬件加速。 1506 | 1507 | 304 1508 | 00:53:37,140 --> 00:53:42,140 1509 | Our GPU work is gonna work on CUDA using CUDA libraries. 1510 | 我们的GPU工作将使用CUDA库在CUDA上工作。 1511 | 1512 | 305 1513 | 00:53:42,270 --> 00:53:57,520 1514 | So you could do one that uses OpenCL or maybe optimizes for the M1 Apple chip, stuff like this, right? All these things are possible, or maybe you do sort of hardware fused optimization for fused operators and things like this. 1515 | 所以你可以做一个使用OpenCL的,或者可能针对M1苹果芯片进行优化的,诸如此类的东西,对吧?所有这些都是可能的,或者你可以做一些硬件融合优化,用于融合运算符等等。 1516 | 1517 | 306 1518 | 00:53:57,520 --> 00:54:01,320 1519 | These there all potential projects, we'll also post a few more possibilities. 1520 | 这些都是潜在的项目,我们也会发布一些更多的可能性。 1521 | 1522 | 307 1523 | 00:54:01,320 --> 00:54:05,943 1524 | But the idea is that you want to do some extension of needle as your final project. 1525 | 但是想法是你想做一些needle的扩展作为你的最终项目。 1526 | 1527 | 308 1528 | 00:54:07,560 --> 00:54:11,700 1529 | And finally, the last thing is the course forum. 1530 | 最后,最后一件事是课程论坛。 1531 | 1532 | 309 1533 | 00:54:11,700 --> 00:54:17,700 1534 | So for those who sign up for the course, and actually again, this part requires you to actually enroll in the course. 1535 | 所以对于那些报名参加课程的人,实际上,这部分需要你实际上在课程中注册。 1536 | 1537 | 310 1538 | 00:54:17,700 --> 00:54:29,123 1539 | When you enroll in the course, you will soon thereafter get an invitation to join the class forum where you could log in after this class, after watching this lecture, if you haven't done so yet. 1540 | 当你注册课程后,你很快就会收到一个邀请加入班级论坛的邀请,在这个课程之后,如果你还没有这样做的话,你可以登录。 1541 | 1542 | 311 1543 | 00:54:30,120 --> 00:54:38,043 1544 | And you should use this course forum, essentially as a resource to discuss and talk about the aspects of the course. 1545 | 你应该将这个课程论坛作为一个资源,讨论和谈论课程的各个方面。 1546 | 1547 | 312 1548 | 00:54:39,210 --> 00:54:43,860 1549 | You can and should ask for help, for example, with assignments in the forum. 1550 | 你可以和应该在论坛中寻求帮助,例如,对于作业的问题。 1551 | 1552 | 313 1553 | 00:54:43,860 --> 00:54:52,505 1554 | We won't be able to answer all questions that is, we instructors and the TAs won't be able to answer all of them just due to sort of availability. 1555 | 我们不可能回答所有的问题,也就是说,我们的教师和TAs不可能回答所有的问题,因为时间有限。 1556 | 1557 | 314 1558 | 00:54:52,505 --> 00:54:58,770 1559 | But please do up vote questions that you find important and relevant that you are struggling with maybe. 1560 | 但是请up vote你认为重要和相关的问题,你可能遇到的问题。 1561 | 1562 | 315 1563 | 00:54:58,770 --> 00:55:06,630 1564 | And we will try to answer the most upvoted or the most liked questions to be sure that they're not sort of widespread issues that everyone's encountering. 1565 | 我们会尽力回答最受欢迎或最受喜欢的问题,以确保它们不是每个人都遇到的普遍问题。 1566 | 1567 | 316 1568 | 00:55:06,630 --> 00:55:20,393 1569 | But then also please do help by answering questions from other students, right? We want to form somewhat of a community around this course here, so please do not just post questions, but also see if you can answer questions from other students. 1570 | 但是也请帮助回答其他学生的问题,对吧?我们希望在这个课程周围形成一个社区,所以请不要只发布问题,还要看看是否可以回答其他学生的问题。 1571 | 1572 | 317 1573 | 00:55:20,393 --> 00:55:24,393 1574 | The more you're able to do that, the more everyone kind of benefits. 1575 | 你越能做到这一点,每个人都会从中受益。 1576 | 1577 | 318 1578 | 00:55:25,500 --> 00:55:30,360 1579 | You can ask for help and that does include in some cases posting code. 1580 | 你可以寻求帮助,有时候包括发布代码。 1581 | 1582 | 319 1583 | 00:55:30,360 --> 00:55:37,890 1584 | But please we have further, or I should say further instructions are posted in the main welcome message in the forum. 1585 | 但请注意,我们在论坛的主要欢迎信息中发布了进一步的说明。 1586 | 1587 | 320 1588 | 00:55:37,890 --> 00:56:00,330 1589 | But we do have some sort of formal rules, but the reality is you can do things like post code and stuff and you can even share small amounts of code, but please be reasonable, don't just verbatim share entire solutions on the course forum, you get the most out of this course by implementing the assignments yourselves. 1590 | 我们确实有一些正式的规定,但现实是你可以发布代码和其他东西,甚至可以分享少量的代码,但请合理,不要在课程论坛上直接分享整个解决方案,你可以通过自己实现任务来获得最大的收益。 1591 | 1592 | 321 1593 | 00:56:00,330 --> 00:56:09,150 1594 | And if you post your code, then that the makes other people not able to have that experience, or they just end up copying the code and not writing it themselves. 1595 | 如果你发布了你的代码,那么其他人就无法获得那种体验,或者他们最终只是复制代码而不是自己编写。 1596 | 1597 | 322 1598 | 00:56:09,150 --> 00:56:16,380 1599 | And so be reasonable when it comes to what you post in the forums, you can absolutely share code and share at least snippets of code and things like this. 1600 | 因此,在论坛上发布什么内容时要合理,你可以分享代码和代码片段等。 1601 | 1602 | 323 1603 | 00:56:16,380 --> 00:56:36,993 1604 | Again, it's an online course, so you could in some sense, do whatever you want, but at least in the public forum, please do be sort of reasonable in terms of not trying to give away content for people that would rather not sort of see the full solutions posted for the assignments. 1605 | 再次强调,这是一门在线课程,你可以在某种程度上做任何你想做的事情,但至少在公共论坛上,请合理,不要试图为那些不想看到完整解决方案的人提供内容。 1606 | 1607 | 324 1608 | 00:56:39,450 --> 00:56:47,280 1609 | All right, with that, I'm ending the first lecture here with a few parting words. 1610 | 好了,我在这里结束了第一讲,留下几句话。 1611 | 1612 | 325 1613 | 00:56:47,280 --> 00:56:54,483 1614 | So we're really excited to be able to offer this course publicly and we really look forward to having you in the course. 1615 | 我们非常高兴能够公开提供这门课程,我们真的很期待你加入这门课程。 1616 | 1617 | 326 1618 | 00:56:55,470 --> 00:57:01,980 1619 | And if you do have feedback or comments for us, please let us know. 1620 | 如果你有反馈或意见,请告诉我们。 1621 | 1622 | 327 1623 | 00:57:01,980 --> 00:57:16,980 1624 | Now it may not be possible to make changes during this offering, but we really want, we are making this course public because we want it to be a resource for those that are interested in deep learning systems, or just interested in deep learning as a whole. 1625 | 现在可能不可能在这个过程中进行更改,但我们真的希望,我们公开这门课程是因为我们希望它成为一个资源,为那些对深度学习系统感兴趣或对深度学习整体感兴趣的人提供帮助。 1626 | 1627 | 328 1628 | 00:57:16,980 --> 00:57:23,883 1629 | And if you can give us feedback that can help us improve at that mission, we appreciate it. 1630 | 如果你能给我们反馈,帮助我们实现这个目标,我们将不胜感激。 1631 | 1632 | 329 1633 | 00:57:25,050 --> 00:57:32,130 1634 | So we look forward to having you in the course, as I said, I promise the next lecture is much more content full. 1635 | 所以我们期待你加入这门课程,就像我说的,我保证下一讲会更加充实。 1636 | 1637 | 330 1638 | 00:57:32,130 --> 00:57:42,120 1639 | So if you got through this and said, hey, where's the, I haven't learned anything yet, where's all the content? Look at the next lecture next, it will cover some of the basics of machine learning. 1640 | 如果你已经通过了这个,说:“嘿,我还没学到什么,所有的内容在哪里?”请看下一讲,它将涵盖一些机器学习的基础知识。 1641 | 1642 | 331 1643 | 00:57:42,120 --> 00:57:45,270 1644 | And then soon we'll get into automatic differentiation after that. 1645 | 然后很快我们会进入自动微分的内容。 1646 | 1647 | 332 1648 | 00:57:45,270 --> 00:57:52,370 1649 | But we really look forward to having you and we hope you enjoy this course as much as we're enjoying putting it together. 1650 | 但我们真的很期待你的加入,希望你和我们一样喜欢这门课程。 1651 | 1652 | -------------------------------------------------------------------------------- /translate.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | import time 4 | from logger import logger 5 | import openai 6 | 7 | sks = os.environ.get("OPENAI_KEY").split(";") 8 | 9 | # @policy A: 逐句翻译 无风险,但可能会丢失上下文信息,浪费 tokens,可能超出并发请求上限 10 | def translate_by_sentence(sentence): 11 | message = f"把下面的句子翻译成中文:\n{sentence}" 12 | # 请求直到成功,openai 的速率检测太迷! 13 | while True: 14 | try: 15 | # 可能 6 个 key 就不需要等待了? 16 | time.sleep(max(1, 6-len(sks))) 17 | openai.api_key = random.choice(sks) 18 | result = openai.ChatCompletion.create( 19 | model="gpt-3.5-turbo", 20 | messages=[ 21 | {"role": "user", "content": message} 22 | ], 23 | temperature=0.2 24 | ) 25 | break 26 | except Exception as e: 27 | logger.warning(e) 28 | 29 | logger.info(f"消耗 tokens: {result['usage']['total_tokens']}") 30 | logger.info(sentence) 31 | logger.info(result["choices"][0]["message"]["content"].strip()) 32 | 33 | return result["choices"][0]["message"]["content"].strip() 34 | 35 | # @policy B: 逐段翻译 风险度高 GPT极有可能返回错误的分段 36 | def translate(segment): 37 | message = f"Translate the following paragraph and remain the bracket:\n{segment}" 38 | while True: 39 | try: 40 | openai.api_key = random.choice(sks) 41 | result = openai.ChatCompletion.create( 42 | model="gpt-3.5-turbo", 43 | messages=[ 44 | # system message 的效果不好,也可能是 prompt 没有设置好 45 | {"role": "system", "content": "You are English-Chinese translator."}, 46 | {"role": "user", "content": message} 47 | ], 48 | temperature=0.2 49 | ) 50 | logger.info(f"消耗 tokens: {result['usage']['total_tokens']}") 51 | logger.info(segment) 52 | logger.info(result["choices"][0]["message"]["content"].strip()) 53 | break 54 | except Exception as e: 55 | logger.warning(e) 56 | 57 | return result["choices"][0]["message"]["content"].strip() 58 | --------------------------------------------------------------------------------