zhaozitian commited on
Commit
806585b
·
1 Parent(s): 6357cd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -8,7 +8,7 @@ assert (
8
  ), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
9
  from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig
10
 
11
- tokenizer = LlamaTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
12
 
13
  BASE_MODEL = "meta-llama/Llama-2-7b-chat-hf"
14
  LORA_WEIGHTS = "Sparticle/llama-2-7b-japanese-lora"
@@ -30,6 +30,7 @@ if device == "cuda":
30
  load_in_8bit=False,
31
  torch_dtype=torch.float16,
32
  device_map="auto",
 
33
  )
34
  model = PeftModel.from_pretrained(
35
  model, LORA_WEIGHTS, torch_dtype=torch.float16, force_download=True
@@ -39,6 +40,7 @@ elif device == "mps":
39
  BASE_MODEL,
40
  device_map={"": device},
41
  torch_dtype=torch.float16,
 
42
  )
43
  model = PeftModel.from_pretrained(
44
  model,
 
8
  ), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
9
  from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig
10
 
11
+ tokenizer = LlamaTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf", use_auth_token=True)
12
 
13
  BASE_MODEL = "meta-llama/Llama-2-7b-chat-hf"
14
  LORA_WEIGHTS = "Sparticle/llama-2-7b-japanese-lora"
 
30
  load_in_8bit=False,
31
  torch_dtype=torch.float16,
32
  device_map="auto",
33
+ from_pretrained,
34
  )
35
  model = PeftModel.from_pretrained(
36
  model, LORA_WEIGHTS, torch_dtype=torch.float16, force_download=True
 
40
  BASE_MODEL,
41
  device_map={"": device},
42
  torch_dtype=torch.float16,
43
+ from_pretrained,
44
  )
45
  model = PeftModel.from_pretrained(
46
  model,