Spaces:
Running
on
Zero
Running
on
Zero
DivEye - PR (token) (#4)
Browse files- token changes (0392639a5f17fa83c58b523b8c26a1556f6da092)
- software.py +8 -5
software.py
CHANGED
|
@@ -10,6 +10,7 @@ from tqdm import tqdm
|
|
| 10 |
from torch.nn import CrossEntropyLoss
|
| 11 |
from pathlib import Path
|
| 12 |
import spaces
|
|
|
|
| 13 |
|
| 14 |
class Diversity:
|
| 15 |
def __init__(self, model, tokenizer, device):
|
|
@@ -103,14 +104,16 @@ class Software:
|
|
| 103 |
else:
|
| 104 |
self.device_bi = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 105 |
|
| 106 |
-
self.
|
|
|
|
|
|
|
| 107 |
self.div_model = AutoModelForCausalLM.from_pretrained(
|
| 108 |
-
"tiiuae/falcon-7b", device_map=self.device_div, torch_dtype=torch.float16, trust_remote_code=True
|
| 109 |
)
|
| 110 |
-
|
| 111 |
-
self.bi_tokenizer = AutoTokenizer.from_pretrained("google/gemma-1.1-2b-it", use_fast=False, trust_remote_code=True)
|
| 112 |
self.bi_model = AutoModelForCausalLM.from_pretrained(
|
| 113 |
-
"google/gemma-1.1-2b-it", device_map=self.device_bi, torch_dtype=torch.float16, trust_remote_code=True
|
| 114 |
)
|
| 115 |
|
| 116 |
self.diveye = Diversity(self.div_model, self.div_tokenizer, self.device_div)
|
|
|
|
| 10 |
from torch.nn import CrossEntropyLoss
|
| 11 |
from pathlib import Path
|
| 12 |
import spaces
|
| 13 |
+
import os
|
| 14 |
|
| 15 |
class Diversity:
|
| 16 |
def __init__(self, model, tokenizer, device):
|
|
|
|
| 104 |
else:
|
| 105 |
self.device_bi = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 106 |
|
| 107 |
+
self.token = os.getenv("HF_TOKEN")
|
| 108 |
+
|
| 109 |
+
self.div_tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-7b", use_fast=False, trust_remote_code=True, use_auth_token=self.token)
|
| 110 |
self.div_model = AutoModelForCausalLM.from_pretrained(
|
| 111 |
+
"tiiuae/falcon-7b", device_map=self.device_div, torch_dtype=torch.float16, trust_remote_code=True, use_auth_token=self.token
|
| 112 |
)
|
| 113 |
+
|
| 114 |
+
self.bi_tokenizer = AutoTokenizer.from_pretrained("google/gemma-1.1-2b-it", use_fast=False, trust_remote_code=True, use_auth_token=self.token)
|
| 115 |
self.bi_model = AutoModelForCausalLM.from_pretrained(
|
| 116 |
+
"google/gemma-1.1-2b-it", device_map=self.device_bi, torch_dtype=torch.float16, trust_remote_code=True, use_auth_token=self.token
|
| 117 |
)
|
| 118 |
|
| 119 |
self.diveye = Diversity(self.div_model, self.div_tokenizer, self.device_div)
|