Error Message
NotFoundError: No registered 'RngReadAndSkip' OpKernel for 'GPU' devices compatible with node {
{node RngReadAndSkip}} . Registered: device='XLA_CPU_JIT' device='CPU' [Op:RngReadAndSkip]
Solution
# 텐서를 CPU에 할당
with tf.device('/cpu:0'):
data_augmentation = keras.Sequential(
[
layers.RandomFlip("horizontal"),
layers.RandomRotation(0.1),
layers.RandomZoom(0.2),
]
)
tensorflow-metal 플러그인에 RngReadAndSkip Op가 아직 추가되지 않아서 발생한 문제였다. with tf.device('/cpu:0'): 코드를 한 줄 추가함으로써 해결할 수 있다.
with tf.device
특정 연산을 수행할 장치를 직접 선택할 때 사용한다. 해당 컨텍스트에서의 모든 연산은 지정된 장치에서 수행된다.
Data augmentation 에러가 잘 해결된 것을 확인할 수 있다.
Reference
https://developer.apple.com/forums/thread/695319
Image data augmentation Keras M1 M… | Apple Developer Forums
Please use Tensor Flow TensorFlow Version 2.7.0 As mentioned by Frameworks Engineer & chaitanya_ambaruk, please use the with tf.device('/CPU:0'): PS: Need to place this piece of code in the correct line of code. For the above example please place it before
developer.apple.com
https://www.tensorflow.org/guide/gpu?hl=ko
GPU 사용하기 | TensorFlow Core
GPU 사용하기 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. TensorFlow 코드 및 tf.keras 모델은 코드를 변경할 필요 없이 단일 GPU에서 투명하게 실행됩니다. 참
www.tensorflow.org
'AI 구현 > 환경 세팅' 카테고리의 다른 글
[WSL] wget: unable to resolve host address 에러 해결 (0) | 2025.01.12 |
---|---|
[Docker] NVIDIA Container Toolkit 설치 과정 (0) | 2025.01.09 |
CLOVA Speech API 사용법 및 화자분할 테스트 (0) | 2024.05.13 |
맥북 M1 pro에 Tensorflow, Keras 개발 환경 세팅하기 (1) | 2023.10.30 |
google-colab import 시 오류 해결(AttributeError: module 'IPython.utils.traitlets' has no attribute 'Unicode') (0) | 2023.09.30 |