---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://catboost.ai/docs/en/concepts/java-reference_catboostmodel__loadmodel.md
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# loadModel

The CatBoost Java package provides different methods for loading CatBoost models.

## Load the model from a stream {#loadfromastream}

```java
public static CatBoostModel loadModel(java.io.InputStream in)
```

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java__loadcatboost-from-stream__desc.md -->
Load the CatBoost model from a stream.
<!-- endsource: en/_includes/work_src/reusage-java/java__loadcatboost-from-stream__desc.md -->


#### Parameters

**in**

The input stream with the CatBoost model.

#### Returns

<!-- source: en/_includes/work_src/reusage-java/java__load-model__returns.md -->
CatBoost model.
<!-- endsource: en/_includes/work_src/reusage-java/java__load-model__returns.md -->


#### Throws

- <!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__when-model-not-loaded.md -->
  `CatBoostError` — When the attempt to load the model fails.
  <!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__when-model-not-loaded.md -->

- <!-- source: en/_includes/work_src/reusage-java/throws__javaioioexception.md -->
  `java.io.IOException` — When the attempt to read the model fails.
  <!-- endsource: en/_includes/work_src/reusage-java/throws__javaioioexception.md -->


## Load the model from a file {#loadfromafile}

```java
public static CatBoostModel loadModel(String modelPath)
```

#### Purpose

<!-- source: en/_includes/work_src/reusage-java/java__loadcatboost-from-file__desc.md -->
Load the CatBoost model from a file.
<!-- endsource: en/_includes/work_src/reusage-java/java__loadcatboost-from-file__desc.md -->


#### Parameters

**modelPath**

The path to the input CatBoost model.

#### Returns

<!-- source: en/_includes/work_src/reusage-java/java__load-model__returns.md -->
CatBoost model.
<!-- endsource: en/_includes/work_src/reusage-java/java__load-model__returns.md -->


#### Throws

- <!-- source: en/_includes/work_src/reusage-java/throws__catboosterror__when-model-not-loaded.md -->
  `CatBoostError` — When the attempt to load the model fails.
  <!-- endsource: en/_includes/work_src/reusage-java/throws__catboosterror__when-model-not-loaded.md -->

- <!-- source: en/_includes/work_src/reusage-java/throws__javaioioexception.md -->
  `java.io.IOException` — When the attempt to read the model fails.
  <!-- endsource: en/_includes/work_src/reusage-java/throws__javaioioexception.md -->

