root commited on
Commit
5d42e7c
·
1 Parent(s): 29edf2c

download checkpoints bug

Browse files
Files changed (2) hide show
  1. app.py +0 -3
  2. model.py +4 -1
app.py CHANGED
@@ -11,9 +11,6 @@ def run():
11
  case_placeholder = summaries.random_summary()
12
  model = Model(model_path=model_path, tokenzier_path=tokenizer_path)
13
 
14
- #download files if running
15
- if env == 'gcp':
16
- model.download_checkpoints(bucket_name=bucket_name)
17
  with gr.Blocks() as demo:
18
  cache = gr.Textbox(visible=False)
19
  description = gr.Markdown(value=readme)
 
11
  case_placeholder = summaries.random_summary()
12
  model = Model(model_path=model_path, tokenzier_path=tokenizer_path)
13
 
 
 
 
14
  with gr.Blocks() as demo:
15
  cache = gr.Textbox(visible=False)
16
  description = gr.Markdown(value=readme)
model.py CHANGED
@@ -3,7 +3,7 @@ import os
3
  from threading import Thread
4
  from google.cloud import storage
5
  from transformers import LlamaForCausalLM, LlamaTokenizer, BitsAndBytesConfig, TextIteratorStreamer, pipeline
6
- from config import model_path, tokenizer_path, max_new_tokens, bucket_name, model_files
7
 
8
  class Model:
9
  '''Client class for holding Llama2 model and tokenizer. Models are loaded according to
@@ -22,6 +22,9 @@ class Model:
22
  bnb_4bit_quant_type="nf4",
23
  bnb_4bit_compute_dtype=torch.float16,
24
  )
 
 
 
25
  self.model = LlamaForCausalLM.from_pretrained(model_path, quantization_config=self.bnb_config)
26
  self.tokenizer = LlamaTokenizer.from_pretrained(tokenzier_path)
27
  self.streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True)
 
3
  from threading import Thread
4
  from google.cloud import storage
5
  from transformers import LlamaForCausalLM, LlamaTokenizer, BitsAndBytesConfig, TextIteratorStreamer, pipeline
6
+ from config import model_path, tokenizer_path, max_new_tokens, bucket_name, model_files, env
7
 
8
  class Model:
9
  '''Client class for holding Llama2 model and tokenizer. Models are loaded according to
 
22
  bnb_4bit_quant_type="nf4",
23
  bnb_4bit_compute_dtype=torch.float16,
24
  )
25
+ #download files if running GCP
26
+ if env == 'gcp':
27
+ self.download_checkpoints(bucket_name=bucket_name)
28
  self.model = LlamaForCausalLM.from_pretrained(model_path, quantization_config=self.bnb_config)
29
  self.tokenizer = LlamaTokenizer.from_pretrained(tokenzier_path)
30
  self.streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True)