JustKiddo commited on
Commit
c25ba20
1 Parent(s): faa133e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -3,18 +3,17 @@ import os
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
  from huggingface_hub import login
5
 
6
- sec_token=os.getenv("HF_TOKEN")
7
- login(token=sec_token)
8
 
9
  import torch
10
 
11
  class VietnameseChatbot:
12
- def __init__(self, model_name="meta-llama/Llama-2-13b-hf"):
13
  """
14
  Initialize the Vietnamese chatbot with a pre-trained model
15
  """
16
- self.tokenizer = AutoTokenizer.from_pretrained(model_name, token=sec_token)
17
- self.model = AutoModelForCausalLM.from_pretrained(model_name, token=sec_token)
18
 
19
  # Use GPU if available
20
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
 
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
  from huggingface_hub import login
5
 
6
+ login(token=os.getenv('HF_TOKEN'))
 
7
 
8
  import torch
9
 
10
  class VietnameseChatbot:
11
+ def __init__(self, model_name="meta-llama/Llama-2-13b-hf", token=os.getenv('HF_TOKEN')):
12
  """
13
  Initialize the Vietnamese chatbot with a pre-trained model
14
  """
15
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name, token)
16
+ self.model = AutoModelForCausalLM.from_pretrained(model_name, token)
17
 
18
  # Use GPU if available
19
  self.device = "cuda" if torch.cuda.is_available() else "cpu"