Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -172,6 +172,8 @@ def show_mitigation(bias_type):
|
|
| 172 |
|
| 173 |
#function to set up and return LLama 3.2-1b Instruct model transformer and its tokenizer + the Regard classifier model from Hugging Face
|
| 174 |
def setup_models():
|
|
|
|
|
|
|
| 175 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
|
| 176 |
#set pad_token_id to eos_token_id if it's not already defined
|
| 177 |
if tokenizer.pad_token_id is None:
|
|
@@ -181,6 +183,7 @@ def setup_models():
|
|
| 181 |
bias_pipe = pipeline(
|
| 182 |
"text-generation",
|
| 183 |
model="meta-llama/Llama-3.2-1B-Instruct",
|
|
|
|
| 184 |
tokenizer=tokenizer, #pass the tokenizer with pad_token_id set
|
| 185 |
device=0 if torch.cuda.is_available() else -1
|
| 186 |
)
|
|
|
|
| 172 |
|
| 173 |
#function to set up and return LLama 3.2-1b Instruct model transformer and its tokenizer + the Regard classifier model from Hugging Face
|
| 174 |
def setup_models():
|
| 175 |
+
hf_token = os.getenv("fairLLM")
|
| 176 |
+
|
| 177 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
|
| 178 |
#set pad_token_id to eos_token_id if it's not already defined
|
| 179 |
if tokenizer.pad_token_id is None:
|
|
|
|
| 183 |
bias_pipe = pipeline(
|
| 184 |
"text-generation",
|
| 185 |
model="meta-llama/Llama-3.2-1B-Instruct",
|
| 186 |
+
token=hf_token,
|
| 187 |
tokenizer=tokenizer, #pass the tokenizer with pad_token_id set
|
| 188 |
device=0 if torch.cuda.is_available() else -1
|
| 189 |
)
|