Spaces:
Sleeping
Sleeping
Update functions_llama.py
Browse files- functions_llama.py +9 -1
functions_llama.py
CHANGED
@@ -8,16 +8,24 @@ import re
|
|
8 |
from typing import Dict, List
|
9 |
import os
|
10 |
|
|
|
11 |
token = os.getenv('LLAMA_TOKEN')
|
12 |
if token is None:
|
13 |
raise ValueError("LLAMA_TOKEN is not set in the environment variables")
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# Load model and tokenizer
|
17 |
model_name = "meta-llama/Llama-3.3-70B-Instruct"
|
18 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
19 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
20 |
|
|
|
21 |
class HuggingFaceLLM:
|
22 |
def __init__(self, model, tokenizer):
|
23 |
self.model = model
|
|
|
8 |
from typing import Dict, List
|
9 |
import os
|
10 |
|
11 |
+
# Check and retrieve token
|
12 |
token = os.getenv('LLAMA_TOKEN')
|
13 |
if token is None:
|
14 |
raise ValueError("LLAMA_TOKEN is not set in the environment variables")
|
15 |
+
|
16 |
+
# Authentication placeholder (replace with actual implementation if required)
|
17 |
+
def authenticate_with_llama(token):
|
18 |
+
# Example of a login/authentication method
|
19 |
+
print(f"Authenticated successfully with token: {token[:5]}...")
|
20 |
+
|
21 |
+
authenticate_with_llama(token)
|
22 |
|
23 |
# Load model and tokenizer
|
24 |
model_name = "meta-llama/Llama-3.3-70B-Instruct"
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
26 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
27 |
|
28 |
+
|
29 |
class HuggingFaceLLM:
|
30 |
def __init__(self, model, tokenizer):
|
31 |
self.model = model
|