๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐˜ฟ๐™–๐™ฉ๐™–๐™—๐™–๐™จ๐™š/๐˜ผ๐™’๐™Ž

๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import ์ˆœ์„œ์— ๋”ฐ๋ฅธ ์—๋Ÿฌ

by beomcoder 2023. 7. 10.
728x90
๋ฐ˜์‘ํ˜•

๋กœ์ปฌ์—์„œ๋Š” ๋ฌธ์ œ์—†์ด ๋Œ์•„๊ฐ€๋Š” ์ฝ”๋“œ๊ฐ€ AWS ์„œ๋ฒ„๋กœ ์˜ฎ๊ธฐ๋‹ˆ๊นŒ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

terminate called after throwing an instance of 'std::runtime_error'
  what():  random_device could not be read

๋‚œ์ƒ ์ฒ˜์Œ๋ณด๋Š” ์—๋Ÿฌ์ด๊ณ  ๋กœ์ปฌ์—์„œ๋Š” ๋Œ์•„๊ฐ€๋‹ˆ ๋‚œ๊ฐํ–ˆ๋‹ค.

๊ทธ๋ž˜๋„ ๋‹คํ–‰ํžˆ ํ•˜๋‚˜๋งŒ ์ถ”๊ฐ€ํ–ˆ๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ด์„œ ๊ธˆ๋ฐฉ ์›์ธ์„ ์ฐพ์„ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

๋‚ด๊ฐ€ ์ถ”๊ฐ€ํ•œ๊ฑด ultralytics์ด๊ณ , import torch๋ฅผ ํฌํ•จํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค.

 

๊ฒฐ๋ก ๋ถ€ํ„ฐ ๋งํ•˜์ž๋ฉด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import ์ˆœ์„œ์— ๋”ฐ๋ฅธ AWS์—์„œ๋งŒ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ์˜€๋‹ค.

torch์™€ tensorflow๋ฅผ ๋™์‹œ์— import๋ฅผ ํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”๋ฐ,

 

torch๋ฅผ ๋จผ์ € importํ•˜๊ณ , tensorflow๋ฅผ ๋‚˜์ค‘์— importํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋œ๋‹ค.

 

์™œ ์ด๋Ÿฐ๊ฒŒ ๋ฐœ์ƒํ•˜๋Š”์ง€๋Š” ์ฐพ์ง€ ๋ชปํ–ˆ๋Š”๋ฐ

ํ•œ๋ฒˆ ์›์ธ์„ ์ฐพ๊ณ  ์‹ถ์€๋ถ„๋“ค์€ pytorch issues๋ฅผ ์ฐพ์•„๋ณด๋ฉด ์ข‹๊ฒ ๋‹ค.

 

https://github.com/pytorch/pytorch/issues/101152

 

Importing torch after TensorFlow results in std::runtime_error · Issue #101152 · pytorch/pytorch

๐Ÿ› Describe the bug The following minimal example (Dockerfile, just run docker build with it ) reproduces the error: FROM python:3.11.3 RUN pip install tensorflow==2.12.0 torch==2.0.1 RUN python -c ...

github.com

import tensorflow
import torch

"""
terminate called after throwing an instance of 'std::runtime_error'
  what():  random_device could not be read
Aborted (core dumped)
"""


import torch
import tensorflow

"""
no err
"""
728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€