Pytorch의 기술적인 배경
Pytorch + NPU 온라인 모임 #1�2024-12-04
환영합니다
랩장 소개
랩 1기 목표
랩 운영 방안
gmail과 연동된�email 필요
ML Framework
다양한 기술적인 background가 혼재되어 있음!
오늘 다룰 topic들
Heterogeneous Computing with GPU
Supercomputing
ML Compiler
Pytorch 2.0의 등장으로�더욱 가속화될 것
Numerical Computing for Data Science
ML도 사용성 측면에서 같은 추세
Two (or More) Language Problems
Python의�성능 문제
해결책 #1
고성능 Python compiler를 개발
해결책 #2
Python 언어를 증강
Modular의 Mojo 프로젝트
해결책 #3
다른 언어로 작성된 모듈과 binding
추가로 가속기로 offloading
1
2
3
Eager vs. Graph Mode
Eager, graph�모두 가능
Graph만 가능
TF1 vs. Pytorch Examples
x1 = torch.rand(2, 3)
x2 = torch.rand(2, 3)
y = x1 + x2
print(y)
a = tf.constant([[3, 3]])�b = tf.constant([[2, 2]])�c = tf.matmul(a, b)��With tf.Session() as s:
print(c.eval())
TF1
Pytorch
“c”는 matmul의 결과를 의미하지만�실제 결과값을 알기위해선 “eval”을 호출하여 그래프를 실행해야함
“y”는 “+”가 실행된 결과를 가지고 있음. Pytorch eager mode에서는 별도의 그래프 실행 과정이 필요 없음
Graph Capture: TF2 | Pytorch 2
g = tf.Graph()
with g.as_default():
c = tf.constant(3)
assert c.graph is g
def Foo(x, y):
a = torch.sin(x)
b = torch.cos(y)
return a + b�
foo = Foo
x = torch.rand(3, 4)
y = torch.rand(3, 4)
traced_foo = torch.jit.trace(foo, (x, y))
traced_foo(x, y)��optimized_foo = torch.compile(foo)�optimized_foo(x, y)
TF2
Pytorch 1 & 2
This is not new
Convergence on Pytorch
Pytorch 2.0
향후 강의 계획