AstrAI-video-repo/part1_intro.py

257 lines
6.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
AstrAI项目介绍视频 - Part 1: 开场白与项目定位
"""
from manim import *
class Part1_Intro(Scene):
"""第一部分:开场白与项目定位"""
def construct(self):
# === 场景1Logo动画 ===
self.play_logo_intro()
# === 场景2开场白 ===
self.play_opening_speech()
# === 场景3核心要点展示 ===
self.play_key_points()
# === 场景4项目名称与总结 ===
self.play_project_name()
def play_logo_intro(self):
"""Logo动画展示"""
logo_text = Text(
"AstrAI",
font_size=72,
font="SimHei",
)
subtitle = Text(
"轻量级 Transformer 训练推理框架",
font_size=28,
font="SimHei",
color=GRAY
)
logo_text.next_to(subtitle, UP, buff=0.3)
subtitle.next_to(logo_text, DOWN, buff=0.3)
logo_text.set_opacity(0)
subtitle.set_opacity(0)
self.play(
FadeIn(logo_text, shift=UP * 0.5, scale=1.2),
run_time=1.5
)
self.play(
FadeIn(subtitle, shift=UP * 0.3),
run_time=1.0
)
self.wait(0.8)
self.play(
FadeOut(logo_text),
FadeOut(subtitle),
run_time=0.8
)
self.wait(0.3)
def play_opening_speech(self):
"""开场白"""
line1 = Text(
"在当下的大语言模型时代,",
font_size=32,
font="SimHei"
)
line1.to_edge(UP, buff=1.0)
self.play(Write(line1), run_time=1.0)
self.wait(0.3)
line2 = Text(
"我们见证了GPT、LLaMA等庞然大物。",
font_size=32,
font="SimHei"
)
line2.next_to(line1, DOWN, buff=0.3)
self.play(Write(line2), run_time=1.0)
self.wait(0.3)
line3 = Text(
"然而,这些模型对硬件要求极高,",
font_size=32,
font="SimHei"
)
line3.next_to(line2, DOWN, buff=0.3)
self.play(Write(line3), run_time=1.0)
self.wait(0.3)
line4 = Text(
"对于普通开发者来说往往遥不可及。",
font_size=32,
font="SimHei",
color=BLUE
)
line4.next_to(line3, DOWN, buff=0.3)
self.play(Write(line4), run_time=1.0)
self.wait(0.8)
question = Text(
"我们能否创建一个既有用又能运行在普通电脑上的模型?",
font_size=28,
font="SimHei",
color=YELLOW
)
question.to_edge(DOWN, buff=1.5)
self.play(Write(question), run_time=1.5)
self.wait(1.0)
self.play(
FadeOut(line1),
FadeOut(line2),
FadeOut(line3),
FadeOut(line4),
FadeOut(question),
run_time=0.8
)
self.wait(0.3)
def play_key_points(self):
"""核心要点展示"""
title = Text(
"AstrAI 的核心特点",
font_size=40,
font="SimHei",
color=WHITE
)
title.to_edge(UP, buff=0.8)
self.play(Write(title), run_time=1.0)
self.wait(0.3)
point1_title = Text(
"轻量级",
font_size=36,
font="SimHei",
color=GREEN
)
point1_title.to_edge(LEFT, buff=2.0).shift(UP * 0.5)
point1_content = Text(
"1B参数中英双语",
font_size=24,
font="SimHei",
color=GRAY
)
point1_content.next_to(point1_title, DOWN, buff=0.2)
point1_content.align_to(point1_title, LEFT)
self.play(
Write(point1_title),
Write(point1_content),
run_time=1.0
)
self.wait(0.5)
point2_title = Text(
"完全自研",
font_size=36,
font="SimHei",
color=BLUE
)
point2_title.next_to(point1_title, DOWN, buff=0.8)
point2_title.align_to(point1_title, LEFT)
point2_content = Text(
"核心代码全部开源",
font_size=24,
font="SimHei",
color=GRAY
)
point2_content.next_to(point2_title, DOWN, buff=0.2)
point2_content.align_to(point2_title, LEFT)
self.play(
Write(point2_title),
Write(point2_content),
run_time=1.0
)
self.wait(0.5)
point3_title = Text(
"训练推理一体化",
font_size=36,
font="SimHei",
color=ORANGE
)
point3_title.next_to(point2_title, DOWN, buff=0.8)
point3_title.align_to(point1_title, LEFT)
point3_content = Text(
"从预训练到推理,一套全搞定",
font_size=24,
font="SimHei",
color=GRAY
)
point3_content.next_to(point3_title, DOWN, buff=0.2)
point3_content.align_to(point3_title, LEFT)
self.play(
Write(point3_title),
Write(point3_content),
run_time=1.0
)
self.wait(1.0)
self.play(
FadeOut(point1_title),
FadeOut(point1_content),
FadeOut(point2_title),
FadeOut(point2_content),
FadeOut(point3_title),
FadeOut(point3_content),
run_time=0.5
)
self.wait(0.3)
def play_project_name(self):
"""项目名称与总结"""
project_name = Text(
"AstrAI",
font_size=80,
font="SimHei",
color=BLUE
)
project_name.center()
self.play(
project_name.animate.scale(1.2),
run_time=1.5
)
self.wait(0.8)
tagline = Text(
"1B参数 · 中英双语 · 完全自研 · 训练推理一体化",
font_size=24,
font="SimHei",
color=YELLOW
)
tagline.next_to(project_name, DOWN, buff=0.5)
self.play(Write(tagline), run_time=1.0)
self.wait(1.0)
self.play(
FadeOut(project_name),
FadeOut(tagline),
run_time=1.0
)
self.wait(0.3)