jhj0517
commited on
Commit
·
669ddd1
1
Parent(s):
d3474be
Fix for cpu environment
Browse files
modules/image_restoration/real_esrgan/real_esrgan_inferencer.py
CHANGED
|
@@ -78,13 +78,15 @@ class RealESRGANInferencer:
|
|
| 78 |
img_path: str,
|
| 79 |
model_name: Optional[str] = None,
|
| 80 |
scale: int = 1,
|
| 81 |
-
half_precision: bool =
|
| 82 |
overwrite: bool = True):
|
| 83 |
model_config = {
|
| 84 |
"model_name": self.model_config["model_name"],
|
| 85 |
"scale": scale,
|
| 86 |
"half_precision": half_precision
|
| 87 |
}
|
|
|
|
|
|
|
| 88 |
if self.model is None or self.model_config != model_config:
|
| 89 |
self.load_model(
|
| 90 |
model_name=self.default_model if model_name is None else model_name,
|
|
|
|
| 78 |
img_path: str,
|
| 79 |
model_name: Optional[str] = None,
|
| 80 |
scale: int = 1,
|
| 81 |
+
half_precision: Optional[bool] = None,
|
| 82 |
overwrite: bool = True):
|
| 83 |
model_config = {
|
| 84 |
"model_name": self.model_config["model_name"],
|
| 85 |
"scale": scale,
|
| 86 |
"half_precision": half_precision
|
| 87 |
}
|
| 88 |
+
half_precision = True if self.device == "cuda" else False
|
| 89 |
+
|
| 90 |
if self.model is None or self.model_config != model_config:
|
| 91 |
self.load_model(
|
| 92 |
model_name=self.default_model if model_name is None else model_name,
|