mirror of
https://github.com/tloen/alpaca-lora.git
synced 2024-10-01 01:05:56 -04:00
Fix torch.compile call on windows (#81)
* Windows not support compile * Fix code style
This commit is contained in:
parent
81eb72f707
commit
450206caaf
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
@ -195,7 +196,7 @@ model.state_dict = (
|
|||||||
lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
|
lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
|
||||||
).__get__(model, type(model))
|
).__get__(model, type(model))
|
||||||
|
|
||||||
if torch.__version__ >= "2":
|
if torch.__version__ >= "2" and sys.platform != 'win32':
|
||||||
model = torch.compile(model)
|
model = torch.compile(model)
|
||||||
|
|
||||||
trainer.train()
|
trainer.train()
|
||||||
|
Loading…
Reference in New Issue
Block a user