Spaces:
Runtime error
Runtime error
clean
Browse files
app.py
CHANGED
|
@@ -12,20 +12,6 @@ model = AutoPeftModelForCausalLM.from_pretrained(
|
|
| 12 |
)
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained("EITD/lora_model_1")
|
| 14 |
|
| 15 |
-
# messages = [{"role": "user", "content": "Continue the Fibonacci sequence: 1, 1, 2, 3, 5, 8,"},]
|
| 16 |
-
|
| 17 |
-
# inputs = tokenizer.apply_chat_template(
|
| 18 |
-
# messages,
|
| 19 |
-
# tokenize = True,
|
| 20 |
-
# add_generation_prompt = True, # Must add for generation
|
| 21 |
-
# return_tensors = "pt",
|
| 22 |
-
# )
|
| 23 |
-
|
| 24 |
-
# outputs = model.generate(input_ids = inputs, max_new_tokens = 64, use_cache = True,
|
| 25 |
-
# temperature = 1.5, min_p = 0.1)
|
| 26 |
-
|
| 27 |
-
# print(tokenizer.batch_decode(outputs))
|
| 28 |
-
|
| 29 |
def respond(
|
| 30 |
message,
|
| 31 |
history: list[tuple[str, str]],
|
|
@@ -72,7 +58,6 @@ def respond(
|
|
| 72 |
# model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = max_tokens,
|
| 73 |
# use_cache = True, temperature = temperature, min_p = top_p)
|
| 74 |
response = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
|
| 75 |
-
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
| 76 |
|
| 77 |
if "assistant" in response:
|
| 78 |
response = response.split("assistant")[-1].strip()
|
|
|
|
| 12 |
)
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained("EITD/lora_model_1")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def respond(
|
| 16 |
message,
|
| 17 |
history: list[tuple[str, str]],
|
|
|
|
| 58 |
# model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = max_tokens,
|
| 59 |
# use_cache = True, temperature = temperature, min_p = top_p)
|
| 60 |
response = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
|
|
|
|
| 61 |
|
| 62 |
if "assistant" in response:
|
| 63 |
response = response.split("assistant")[-1].strip()
|