Spaces:
Sleeping
Sleeping
trust remote code
Browse files
app.py
CHANGED
@@ -15,11 +15,12 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
15 |
# requires space hardware update to use large models (TODO)
|
16 |
# client = InferenceClient("mistralai/Mistral-Large-Instruct-2407")
|
17 |
# Note change in instantiation***
|
18 |
-
|
|
|
19 |
|
20 |
def authenticate_and_generate(token, message, history, system_message, max_tokens, temperature, top_p):
|
21 |
# Initialize the text-generation pipeline with the provided token
|
22 |
-
text_generator = pipeline("text-generation", model="
|
23 |
|
24 |
# Construct the prompt with system message, history, and user input
|
25 |
prompt = system_message + "\n" + "\n".join([f"User: {msg[0]}\nAssistant: {msg[1]}" for msg in history if msg[0] and msg[1]])
|
|
|
15 |
# requires space hardware update to use large models (TODO)
|
16 |
# client = InferenceClient("mistralai/Mistral-Large-Instruct-2407")
|
17 |
# Note change in instantiation***
|
18 |
+
# pipeline move to func
|
19 |
+
# text_generator = pipeline("text-generation", model="microsoft/Phi-3-mini-4k-instruct", use_auth_token=hf_token, trust_remote_code=True)
|
20 |
|
21 |
def authenticate_and_generate(token, message, history, system_message, max_tokens, temperature, top_p):
|
22 |
# Initialize the text-generation pipeline with the provided token
|
23 |
+
text_generator = pipeline("text-generation", model="microsoft/Phi-3-mini-4k-instruct", use_auth_token=hf_token, trust_remote_code=True)
|
24 |
|
25 |
# Construct the prompt with system message, history, and user input
|
26 |
prompt = system_message + "\n" + "\n".join([f"User: {msg[0]}\nAssistant: {msg[1]}" for msg in history if msg[0] and msg[1]])
|