모델 가중치 다운로드
inference 패키지가 모델 가중치를 다운로드하고 캐시하는 방식, 영구 캐시 디렉터리를 구성하는 방법, 가중치를 미리 다운로드하는 방법.
마지막 업데이트
도움이 되었나요?
도움이 되었나요?
export MODEL_CACHE_DIR="/home/user/.roboflow/cache"mkdir -p /home/user/.roboflow/cache
chmod 755 /home/user/.roboflow/cachefrom inference import get_model
# 모델 로드(가중치를 다운로드하고 캐시함)
model = get_model(
model_id="rfdetr-base",
api_key="YOUR_ROBOFLOW_API_KEY"
)
print("모델 가중치가 캐시되었습니다!")from inference import get_model
# 기기 내 추론에 캐시된 가중치 사용
model = get_model(
model_id="rfdetr-base",
api_key="YOUR_ROBOFLOW_API_KEY"
)
results = model.infer("path/to/image.jpg")chmod -R 755 /path/to/cache