> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/reference/ko/inference/inference-sdk/model-management.md).

# 모델 관리

## 모델 가중치 다운로드

자체 호스팅 Inference Server를 사용할 때는 추론을 실행하기 전에 모델을 미리 불러와 가중치를 다운로드하고 캐시할 수 있습니다:

```python
from inference_sdk import InferenceHTTPClient

client = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="YOUR_ROBOFLOW_API_KEY"
)

# 모델 미리 불러오기(가중치를 서버 캐시에 다운로드)
client.load_model(model_id="rfdetr-base")
```

또는 첫 추론을 실행하면 다운로드가 자동으로 시작됩니다.

Workflows의 경우, Workflow에서 사용되는 모든 모델도 미리 불러오고 Workflow를 한 번 실행하여 정의를 캐시해야 합니다.

서버에 어떤 모델이 로드되어 있는지 확인할 수 있습니다:

```python
loaded_models = client.list_loaded_models()
print(f"Loaded models: {loaded_models}")
```

다음에 대해 자세히 읽어보세요 [가중치 캐싱, 영구 저장소, Docker 구성](/reference/ko/inference/inference-python/offline-weights.md).

## Inference Server를 제어하는 방법

### 서버 정보 가져오기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.get_server_info()
```

### 로드된 모델 목록 보기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.list_loaded_models()
```

비동기 대응: `list_loaded_models_async()`

### 특정 모델 설명 가져오기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.get_model_description(model_id="some/1", allow_loading=True)
```

만약 `allow_loading` 가 `True`로 설정되어 있으면, 모델이 아직 로드되지 않았을 경우 부수 효과로 로드됩니다. 기본값: `True`.

비동기 대응: `get_model_description_async()`

### 모델 로드하기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.load_model(model_id="some/1", set_as_default=True)
```

지정된 모델이 로드됩니다. 만약 `set_as_default` 가 `True`가 성공적인 로드 후 클라이언트의 기본 모델로 사용됩니다. 기본값: `False`.

비동기 대응: `load_model_async()`

### 모델 언로드하기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.unload_model(model_id="some/1")
```

때로는 서버 측 OOM을 방지하기 위해 모델을 언로드해야 합니다.

비동기 대응: `unload_model_async()`

### 모든 모델 언로드하기

```python
from inference_sdk import InferenceHTTPClient

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)
CLIENT.unload_all_models()
```

비동기 대응: `unload_all_models_async()`
