C.W.K.
Stream
Lesson 03 of 06 · published

Data pipeline 옵션

~8 min · data

Level 0Keras 도제
0 XP0/97 lessons0/20 achievements
0/120 XP to next level120 XP to go0% complete

네 갈래: (1) numpy array — 작은 dataset, 가장 단순. (2) tf.data.Dataset — TF backend, 가장 성숙, multi-thread / prefetch / shuffle 다 native. (3) torch.DataLoader — PyTorch backend, num_workers 로 multi-process. (4) grain — JAX 의 native data API.

backend 와 무관하게 model.fit() 에 넘기면 알아서 처리. 단 generator 또는 iterable 면 batch_size 인자 무시되니까 dataset 자체가 batch 만들어야.

Code

# All of these work with model.fit():
model.fit(numpy_x, numpy_y)              # NumPy arrays
model.fit(tf_dataset)                     # tf.data.Dataset
model.fit(torch_dataloader)               # PyTorch DataLoader
model.fit(keras_pydataset)                # keras.utils.PyDataset

External links

Exercise

CIFAR-10 을 tf.data.Dataset 에 wrap (batch + shuffle + prefetch). 학습. 그다음 torch.utils.data.DataLoader 로 재구현 (KERAS_BACKEND=torch). epoch 시간 비교.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.