Bryce commited on
Commit ·
70d47ce
1
Parent(s): b325022
feature: add HAT super-resolution weights
Browse files
src/convert_to_safetensors.py
CHANGED
|
@@ -14,13 +14,15 @@ def convert_folder_to_safetensors(input_folder: str, output_folder: str):
|
|
| 14 |
relative_path = os.path.relpath(file_path, input_folder)
|
| 15 |
output_path = os.path.join(output_folder, relative_path)
|
| 16 |
output_path = output_path.rsplit('.', 1)[0] + '.safetensors'
|
| 17 |
-
print(f'
|
| 18 |
# Ensure output directory exists
|
| 19 |
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
| 20 |
|
| 21 |
-
data = dict(torch.load(file_path))
|
| 22 |
if "params" in data:
|
| 23 |
data = data["params"]
|
|
|
|
|
|
|
| 24 |
|
| 25 |
save_file(data, output_path)
|
| 26 |
|
|
|
|
| 14 |
relative_path = os.path.relpath(file_path, input_folder)
|
| 15 |
output_path = os.path.join(output_folder, relative_path)
|
| 16 |
output_path = output_path.rsplit('.', 1)[0] + '.safetensors'
|
| 17 |
+
print(f'\nConverting {file_path} to {output_path}')
|
| 18 |
# Ensure output directory exists
|
| 19 |
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
| 20 |
|
| 21 |
+
data = dict(torch.load(file_path, map_location="cpu"))
|
| 22 |
if "params" in data:
|
| 23 |
data = data["params"]
|
| 24 |
+
model_dtype = data[list(data.keys())[-1]].dtype
|
| 25 |
+
print(f"Model dtype: {model_dtype}")
|
| 26 |
|
| 27 |
save_file(data, output_path)
|
| 28 |
|
weights/super-resolution/hat/4xNomos8kHAT-L_otf.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80fbb305d7bdcdc00ef0281f2180d2d7fdb2b573c7c159755957b4f32c7bd0bf
|
| 3 |
+
size 165299372
|