Zimix commited on
Commit
3a06052
·
1 Parent(s): d72fd01

Update interaction.py

Browse files
Files changed (1) hide show
  1. interaction.py +3 -2
interaction.py CHANGED
@@ -8,15 +8,16 @@ import gradio as gr
8
  from transformers import AutoTokenizer, LlamaForCausalLM
9
  from utils import SteamGenerationMixin
10
 
 
11
 
12
  class MindBot(object):
13
  def __init__(self, model_path, tokenizer_path,if_int8=False):
14
  # self.device = torch.device("cuda")
15
  # device_ids = [1, 2]
16
  if if_int8:
17
- self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto', load_in_8bit=True,use_auth_token='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').eval()
18
  else:
19
- self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto',use_auth_token='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').half().eval()
20
 
21
  self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
22
  # sp_tokens = {'additional_special_tokens': ['<human>', '<bot>']}
 
8
  from transformers import AutoTokenizer, LlamaForCausalLM
9
  from utils import SteamGenerationMixin
10
 
11
+ auth_token = os.getenv("SECRET_TOKEN")
12
 
13
  class MindBot(object):
14
  def __init__(self, model_path, tokenizer_path,if_int8=False):
15
  # self.device = torch.device("cuda")
16
  # device_ids = [1, 2]
17
  if if_int8:
18
+ self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto', load_in_8bit=True,use_auth_token=auth_token).eval()
19
  else:
20
+ self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto',use_auth_token=auth_token).half().eval()
21
 
22
  self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
23
  # sp_tokens = {'additional_special_tokens': ['<human>', '<bot>']}