Spaces:
Sleeping
Sleeping
edited auth token
Browse files
app.py
CHANGED
@@ -22,10 +22,17 @@ llama_pipeline = pipeline(
|
|
22 |
"text-generation",
|
23 |
model=llama_model_id,
|
24 |
model_kwargs={"torch_dtype": torch.bfloat16},
|
25 |
-
device_map="auto"
|
26 |
-
use_auth_token=access_token # Use the access token for authentication
|
27 |
)
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
@app.get("/generate")
|
30 |
def generate(text: str):
|
31 |
"""
|
|
|
22 |
"text-generation",
|
23 |
model=llama_model_id,
|
24 |
model_kwargs={"torch_dtype": torch.bfloat16},
|
25 |
+
device_map="auto"
|
|
|
26 |
)
|
27 |
|
28 |
+
# Überprüfe, ob das Zugriffstoken vorhanden ist
|
29 |
+
if access_token is None:
|
30 |
+
raise ValueError("Access token is missing. Make sure it is set as an environment variable.")
|
31 |
+
|
32 |
+
# Verwende das Zugriffstoken für die Authentifizierung
|
33 |
+
llama_pipeline.tokenizer.model.tokenizer_kwargs.pop("use_auth_token", None)
|
34 |
+
|
35 |
+
|
36 |
@app.get("/generate")
|
37 |
def generate(text: str):
|
38 |
"""
|