Spaces:
Paused
Paused
aeb56
commited on
Commit
·
d3d4339
1
Parent(s):
79334bc
Use sequential device_map to fix key naming conflicts during LoRA merge
Browse files
app.py
CHANGED
|
@@ -108,6 +108,7 @@ class ModelMerger:
|
|
| 108 |
# Load base model with explicit multi-GPU configuration
|
| 109 |
progress(0.25, desc="Loading base model (this may take several minutes)...")
|
| 110 |
logger.info(f"Loading base model: {BASE_MODEL_NAME}")
|
|
|
|
| 111 |
|
| 112 |
if use_8bit:
|
| 113 |
logger.info(f"Using 8-bit quantization for memory efficiency (~50% memory reduction)")
|
|
@@ -117,13 +118,13 @@ class ModelMerger:
|
|
| 117 |
precision_desc = "bfloat16"
|
| 118 |
|
| 119 |
try:
|
|
|
|
|
|
|
| 120 |
load_kwargs = {
|
| 121 |
"trust_remote_code": True,
|
| 122 |
"low_cpu_mem_usage": True,
|
| 123 |
-
"device_map": "auto"
|
| 124 |
"max_memory": max_memory,
|
| 125 |
-
"offload_folder": "/tmp/offload",
|
| 126 |
-
"offload_state_dict": True,
|
| 127 |
}
|
| 128 |
|
| 129 |
if use_8bit:
|
|
|
|
| 108 |
# Load base model with explicit multi-GPU configuration
|
| 109 |
progress(0.25, desc="Loading base model (this may take several minutes)...")
|
| 110 |
logger.info(f"Loading base model: {BASE_MODEL_NAME}")
|
| 111 |
+
logger.info(f"Note: For merging, we'll use a simpler device_map to avoid key naming issues")
|
| 112 |
|
| 113 |
if use_8bit:
|
| 114 |
logger.info(f"Using 8-bit quantization for memory efficiency (~50% memory reduction)")
|
|
|
|
| 118 |
precision_desc = "bfloat16"
|
| 119 |
|
| 120 |
try:
|
| 121 |
+
# For merging, use sequential device map to avoid complex key nesting
|
| 122 |
+
# This ensures consistent key names between training and merging
|
| 123 |
load_kwargs = {
|
| 124 |
"trust_remote_code": True,
|
| 125 |
"low_cpu_mem_usage": True,
|
| 126 |
+
"device_map": "sequential", # Changed from "auto" to avoid key nesting issues
|
| 127 |
"max_memory": max_memory,
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
if use_8bit:
|