Merge pull request #20 from ccx1324/lora-device-fix
fix: LoRA device mismatch and checkpoint resume
This commit is contained in:
@@ -110,8 +110,6 @@ class TrainContextBuilder:
|
|||||||
|
|
||||||
def _before_wrap(m):
|
def _before_wrap(m):
|
||||||
m = m.to(device=device)
|
m = m.to(device=device)
|
||||||
if preloaded_state_dict is not None:
|
|
||||||
m.load_state_dict(preloaded_state_dict, strict=False)
|
|
||||||
if cfg.lora is not None:
|
if cfg.lora is not None:
|
||||||
inject_lora(
|
inject_lora(
|
||||||
m,
|
m,
|
||||||
@@ -119,6 +117,8 @@ class TrainContextBuilder:
|
|||||||
alpha=cfg.lora.alpha,
|
alpha=cfg.lora.alpha,
|
||||||
target_modules=set(cfg.lora.target_modules),
|
target_modules=set(cfg.lora.target_modules),
|
||||||
)
|
)
|
||||||
|
if preloaded_state_dict is not None:
|
||||||
|
m.load_state_dict(preloaded_state_dict, strict=False)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
context = TrainContext(
|
context = TrainContext(
|
||||||
|
|||||||
Reference in New Issue
Block a user