A043 GPT只能提高效率,不能代替学习

自从22年底ChatGPT发布以来,这一类人工智能进入了一个空前的巅峰时期,大规模的破圈,普通人也开始为此付费使用,但铺天盖地的宣传宣传下,大家可能高估了此类工具的功能,以为自己作为一个小白,花一笔钱就可以随时使用这款几乎万能的知识库,把它调教成一个春风化雨的好老师

学习的第一步:阅读与理解

这么用GPT确实没问题,GPT训练时也确实吸收了大量知识,更是有RAG、finetune等技术,在某些专业领域调教一番,或者直接用联网的通用工具,完全可以应付普通的学习需求,比如我们想学习一些统计学的简单内容,什么是精确度、灵敏度、特异性?这个问题的答案在网上到处都是,问GPT还是搜索引擎,得到的结果差不多,但GPT不懂的地方可以让他再多讲讲,搜索引擎搜到的文章却基本都是死的,而大部分人的搜索技能并不支持刨根问题式搜索。所以从这个角度来说,用GPT学习是一种好方法

学习的第二步:应用与反馈调整

那我为什么要提出这个标题”GPT只能提高效率,不能代替学习“呢?你会发现我上面举的这个例子,本质上只是学习的一部分:找到学习资料,尽量理解它。这一部分看书、听课、搜索引擎都能做到。而学习还有很重要的部分:在理解的基础上进行应用,根据结果评估自己的学习效果,进行复习、拓展学习。

如果你对某个领域已经建立了基本框架,GPT可以为你锦上添花,比如编程,你已经日常用上Python了,学习一个新的包,以前需要看官方文档,看他人的使用经验,然后自己写或者复制黏贴,然后debug改改,现在可以让GPT直接生成代码直接跑,然后debug改改,根据结果再看更多资料,最终实现功能。无论用不用GPT你都能完成这个过程,因为你早已有了框架,GPT只不过是提高了你写代码的效率。

如果你是一个新人,python课程都没上完,只会print('hello world'),根本没有自己的知识框架,这时就想用python实现一个简单的功能尚且可以做到,举个例子:你想下载youtube某视频,GPT生成的代码比较简单[1],小白也能看懂,基本没有bug可以正常用。

import os

# Replace the playlist URL with your own
playlist_url = "https://www.youtube.com/playlist?list=PLWFKEqUUprKg2le6kvngoNGF3TlWzXlyh"

# Download the playlist
os.system(f"yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --yes-playlist --playlist-start 1 --output '%(playlist_index)s-%(title)s.%(ext)s' {playlist_url}")

但如果想实现一个复杂的功能,纯靠GPT几乎是不可能的,还是例子:下载YouTube视频后,下载这个视频的字幕,然后把字幕嵌入视频中,并且要能够读取一堆链接批量下载。看起来很简单是吧,但是代码一下子复杂到了这种程度(代码越长,理解难度不是线性增加而是指数增加)[2],小白基本看不懂,很容易出bug,而且小白完全没有debug的能力,无法实现最后一步”根据应用结果评估并修正学习“

import re
import yt_dlp
import os
import subprocess
import sys
from typing import List
from youtube_transcript_api import YouTubeTranscriptApi

# 下载视频
def download_video(video_url, outtmpl, quality_options, download=True):
	ydl_opts = {
		'outtmpl': outtmpl,
		'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best',
		'writesubtitles': False,  # 不下载字幕
		'verbose': True,
		'nocheckcertificate': True,
		'nocachdir': True,
		'compat_opts': set(),
		'http_headers': {
			'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.24 Safari/537.36',
			'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
			'Accept-Language': 'en-us,en;q=0.5',
			'Sec-Fetch-Mode': 'navigate'
		}
	}

	with yt_dlp.YoutubeDL(ydl_opts) as ydl:
		try:
			info_dict = ydl.extract_info(video_url, download=download)
			if download:
				available_formats = [f['format_id'] for f in info_dict['formats'] if f['ext'] == 'mp4']
				for quality in quality_options:
					if quality in available_formats:
						ydl_opts['format'] = quality
						break

				ydl.download([video_url])
			return info_dict
		except Exception as e:
			print(f"Error: {e}")
			print(f"Failed to download video: {video_url}")
			return None

def format_time(seconds: float) -> str:
	milliseconds = int((seconds % 1) * 100)
	minutes, seconds = divmod(int(seconds), 60)
	hours, minutes = divmod(minutes, 60)
	return f"{hours:d}:{minutes:02d}:{seconds:02d}.{milliseconds:02d}"

def captions_to_srt(captions: List[dict]) -> List[str]:
	srt_lines = []
	for index, caption in enumerate(captions, start=1):
		start_time = format_time(caption["start"])
		end_time = format_time(caption["start"] + caption["duration"])
		text = caption["text"].replace("\n", " ")

		srt_lines.append(str(index))
		srt_lines.append(f"{start_time} --> {end_time}")
		srt_lines.append(text)
		srt_lines.append("")

	return srt_lines

def srt_to_ass(srt_file: str, ass_file: str):
	with open(srt_file, "r", encoding="utf-8") as f:
		srt_content = f.read()

	ass_lines = [
		"[Script Info]",
		"ScriptType: v4.00+",
		"Collisions: Normal",
		"PlayResX: 384",
		"PlayResY: 288",
		"Timer: 100.0000",
		"",
		"[V4+ Styles]",
		"Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
		"Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,3,0,2,10,10,50,1",
		"",
		"[Events]",
		"Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
	]

	for srt_block in srt_content.strip().split("\n\n"):
		lines = srt_block.strip().split("\n")
		start_time, end_time = lines[1].split(" --> ")
		start_time = start_time.replace(",", ".")
		end_time = end_time.replace(",", ".")
		text = "\\N".join(lines[2:]).replace("\n", "\\N")

		ass_lines.append(f"Dialogue: 0,{start_time},{end_time},Default,,0,0,0,,{text}")

	with open(ass_file, "w", encoding="utf-8") as f:
		f.write("\n".join(ass_lines))

def download_captions(video_id: str, output_file: str):
	try:
		captions = YouTubeTranscriptApi.list_transcripts(video_id)
		chinese_captions = None
		for transcript in captions:
			if transcript.language_code.startswith("zh"):
				chinese_captions_obj = transcript.fetch()
				chinese_captions = chinese_captions_obj
				break
		if chinese_captions:
			srt_lines = captions_to_srt(chinese_captions)
			with open(output_file, "w", encoding="utf-8") as f:
				f.write("\n".join(srt_lines))
			return True
		else:
			print("No Chinese captions available for this video.")
			return False
	except Exception as e:
		print(f"Error: {e}")
		print(f"Failed to download captions for video: {video_id}")
		return False

def embed_subtitles(video_file, subtitle_file, output_file):
	cmd = [
		'ffmpeg',
		'-i', video_file,
		'-i', subtitle_file,
		'-c', 'copy',
		'-c:s', 'ass',
		output_file
	]

	try:
		subprocess.run(cmd, check=True)
		print(f"Subtitles embedded successfully. Output file: {output_file}")
	except subprocess.CalledProcessError as e:
		print(f"Error embedding subtitles: {e}")
		print(f"Failed to embed subtitles for video: {video_file}")

def replace_special_chars(filename):
	return re.sub(r'[\\/*?:"<>|,_|]', '_', filename)

def main(video_urls, max_results=None, download_videos=True):
	quality_options = ['4320', '2160', '1440', '1080']  # 按优先级排列的视频质量选项

	for video_url in video_urls:
		# 步骤0:获取视频信息
		info_dict = download_video(video_url, None, quality_options, download=False)
		if info_dict is None:
			continue

		# 定义输出模板
		safe_title = replace_special_chars(info_dict['title'])
		outtmpl = f'E:/Downloaded_Videos/{safe_title}/{safe_title}.%(ext)s'

		# 步骤1:下载视频(如果启用下载)
		info_dict = download_video(video_url, outtmpl, quality_options, download=download_videos)
		if info_dict is None:
			continue

		# 步骤2:下载字幕
		video_id = info_dict['id']
		title = info_dict['title']

		safe_title = replace_special_chars(title)
		outtmpl_subs = f'E:/Downloaded_Videos/{safe_title}/{safe_title}.%(ext)s'

		video_file = os.path.join("E:/Downloaded_Videos", safe_title, f"{safe_title}.mp4")
		srt_file = os.path.join("E:/Downloaded_Videos", safe_title, f"{safe_title}.srt")
		ass_file = os.path.join("E:/Downloaded_Videos", safe_title, f"{safe_title}.ass")

		# 确保目录存在
		os.makedirs(os.path.dirname(video_file), exist_ok=True)

		if download_captions(video_id, srt_file):
			srt_to_ass(srt_file, ass_file)
			if download_videos:
				output_file = video_file.replace('.mp4', '.mkv')
				# 步骤3:嵌入字幕
				embed_subtitles(video_file, ass_file, output_file)
				print(f"Subtitles downloaded and embedded for video: {video_url}")
			else:
				print(f"Video info retrieved and subtitles downloaded for: {video_url}")
		else:
			if download_videos:
				print(f"Video downloaded, but no subtitles available for: {video_url}")
			else:
				print(f"Video info retrieved, but no subtitles available for: {video_url}")

if __name__ == "__main__":
	with open("video_urls.txt", "r") as f:
		video_urls = [line.strip() for line in f.readlines()]
	main(video_urls, max_results=10, download_videos=True)

这就是为什么我说GPT只能提高效率,不能代替学习,对于有能力的人来说,GPT可以提高效率放大他的能力,以前能力是80,放大后变成三个80(保守一点,放大三倍),一个人能干三个人的活。而没有能力的人,并不能独立依靠GPT工作,以前能力是0,放大后还是三个0。

总结

毫无疑问GPT类工具是个突破性的产物,我个人认为其意义不亚于计算机的诞生,但无论工具再怎么进化,前期的基础知识的学习都需要人自己完成,这个学习过程不管是上课还是看书还是问GPT都无法掠过

就像人们用锄头锄地,就算发明了电子锄头,不会握持锄头的人效率并不会因此提升。当然,如果发明了犁地机,人们就不用学习怎么用锄头了,但可惜的是无论GPT还是其他最近比较火热的ai,比如生成图片,都只是把”电子锄头“

最后,这篇文章的观点直接受到了视频《GPT4能拯救你的口语吗?》的启发,你可以看看他的解读

这个东西它到底是不是一个equalizer,什么是equalizer啊,我打不过泰森,十个我加一块也打不过泰森,泰森一拳就能KO我,但是如果我跟泰森一人拿把手枪,我们两个战斗力方面的对比立马就不一样了,理论上来说,我跟泰森直接就五五开了,或者说呢大家都有枪的情况下,我跟泰森谁能KO对方呢,取决于我们俩的枪法,谁的枪法好,谁就赢了,虽然泰森身体素质比我好100倍,但没什么卵用啊,只要我的枪法准就足够了,这种场景下,手枪就是equalizer,他让一场原本十分不公平的战斗,瞬间就变得公平了,或者说这个equalizer出现之后,战斗的规则就改变了,能更好的使用equalizer的人就能赢,就这么简单,这就是科技的力量。如果你问我如今的GPT4,在英语学习方面算不算得上是equalizer的话,我会告诉你算不上,在外语学习方面,最大的作用就是他对特定人群会特别有用,但对大部分人没什么卵用啊,我举个简单的例子好了,比如现在你手里就拿着这个东西,GPT4给到你了,这玩意儿很牛,能帮人锻炼口语,然后你你练吧,你咋练,你能说出啥来,发现问题没,你啥都说不出来,还是那句话,给你放美国都不好使,然后你觉得如今一个GPT4,就能拯救你的口语了吗,这符合逻辑吗,真实的情况是,用GPT4练口语呢也是有门槛,这就好比用GPT4撸代码也是有门槛的啊,有的人能撸得飞起,但大部分人不行,口语也是一样的,那基础达不到一定程度的同学,GPT4给到你手里也啥也没有。

GP4绝对是非常非常棒的一个学英语的工具,但是它有使用门槛,某种程度上它不但不是一个equalizer,它甚至还会造成两极分化的现象,对于书面技术很不错的同学来说,这个玩意儿可以让你更快的具备很好的口语输出能力,但对于语法非常拉胯的来说,别说GPT4了,GPT10都没用,所以这个工具对于一部分人来说,是非常非常厉害的工具,但对大部分人来说,充其量也就是个质量非常不错的,翻译软件而已

资料


  1. 该代码来自 解剖课推荐——艾氏解剖学(附下载链接) ↩︎

  2. 该代码来自 下载youtube视频后自动插入字幕 - Python - iSharkFly ↩︎