xuxw98 commited on
Commit
81ff9a6
1 Parent(s): 4a93c20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -8,8 +8,8 @@ import lightning as L
8
  import torch
9
 
10
  # support running without installing as a package
11
- wd = Path(__file__).parent.parent.resolve()
12
- sys.path.append(str(wd))
13
 
14
  from generate import generate
15
  from lit_llama import Tokenizer
@@ -32,7 +32,7 @@ torch.set_float32_matmul_precision("high")
32
  def model_load(
33
  adapter_path: Path = Path("out/adapter/alpaca/lit-llama-adapter-finetuned_15k.pth"),
34
  pretrained_path: Path = Path("checkpoints/lit-llama/7B/lit-llama.pth"),
35
- quantize: Optional[str] = None,
36
  ):
37
 
38
  fabric = L.Fabric(devices=1)
@@ -110,11 +110,12 @@ def instruct_generate(
110
  # 配置具体参数
111
  # pretrained_path = hf_hub_download(
112
  # repo_id="Gary3410/pretrain_lit_llama", filename="lit-llama.pth")
113
- tokenizer_path = hf_hub_download(
114
- repo_id="Gary3410/pretrain_lit_llama", filename="tokenizer.model")
115
- adapter_path = hf_hub_download(
116
- repo_id="Gary3410/pretrain_lit_llama", filename="lit-llama-adapter-finetuned_15k.pth")
117
- # adapter_path = "lit-llama-adapter-finetuned_15k.pth"
 
118
  pretrained_path = "lit-llama.pth"
119
  example_path = "example.json"
120
  # 1024如果不够, 调整为512
 
8
  import torch
9
 
10
  # support running without installing as a package
11
+ # wd = Path(__file__).parent.parent.resolve()
12
+ # sys.path.append(str(wd))
13
 
14
  from generate import generate
15
  from lit_llama import Tokenizer
 
32
  def model_load(
33
  adapter_path: Path = Path("out/adapter/alpaca/lit-llama-adapter-finetuned_15k.pth"),
34
  pretrained_path: Path = Path("checkpoints/lit-llama/7B/lit-llama.pth"),
35
+ quantize: Optional[str] = "llm.int8",
36
  ):
37
 
38
  fabric = L.Fabric(devices=1)
 
110
  # 配置具体参数
111
  # pretrained_path = hf_hub_download(
112
  # repo_id="Gary3410/pretrain_lit_llama", filename="lit-llama.pth")
113
+ # tokenizer_path = hf_hub_download(
114
+ # repo_id="Gary3410/pretrain_lit_llama", filename="tokenizer.model")
115
+ # adapter_path = hf_hub_download(
116
+ # repo_id="Gary3410/pretrain_lit_llama", filename="lit-llama-adapter-finetuned_15k.pth")
117
+ adapter_path = "lit-llama-adapter-finetuned_15k.pth"
118
+ tokenizer_path = "tokenizer.model"
119
  pretrained_path = "lit-llama.pth"
120
  example_path = "example.json"
121
  # 1024如果不够, 调整为512