gregH commited on
Commit
d4f4fa0
1 Parent(s): 95469bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -42,13 +42,21 @@ def get_labels(response_list):
42
  print(f"Starting to load the model to memory")
43
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
44
 
 
 
45
  m = AutoModelForCausalLM.from_pretrained(
46
- "google/gemma-2b-it", torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32, trust_remote_code=True)
 
 
 
 
47
  embedding_func=m.get_input_embeddings()
48
  embedding_func.weight.requires_grad=False
49
  m = m.to(device)
50
 
51
- tok = AutoTokenizer.from_pretrained("google/gemma-2b-it", trust_remote_code=True)
 
 
52
  tok.padding_side = "left"
53
  tok.pad_token_id = tok.eos_token_id
54
  # using CUDA for an optimal experience
 
42
  print(f"Starting to load the model to memory")
43
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
44
 
45
+ HF_TOKEN = os.environ.get("HF_TOKEN")
46
+
47
  m = AutoModelForCausalLM.from_pretrained(
48
+ "google/gemma-2b-it",
49
+ torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
50
+ trust_remote_code=True,token=HF_TOKEN
51
+ )
52
+
53
  embedding_func=m.get_input_embeddings()
54
  embedding_func.weight.requires_grad=False
55
  m = m.to(device)
56
 
57
+ tok = AutoTokenizer.from_pretrained("google/gemma-2b-it",
58
+ trust_remote_code=True,token=HF_TOKEN
59
+ )
60
  tok.padding_side = "left"
61
  tok.pad_token_id = tok.eos_token_id
62
  # using CUDA for an optimal experience