Spaces:
Sleeping
Sleeping
Commit
·
ebc9829
1
Parent(s):
36132e7
モデルを変えてみた
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ index.add(np.array(doc_embeddings))
|
|
50 |
|
51 |
def generate_text(prompt):
|
52 |
full_prompt = search(prompt)
|
53 |
-
input_ids = tokenizer(full_prompt, return_tensors="pt").
|
54 |
with torch.no_grad():
|
55 |
output_ids = llm.generate(input_ids, max_new_tokens=256)
|
56 |
result_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
50 |
|
51 |
def generate_text(prompt):
|
52 |
full_prompt = search(prompt)
|
53 |
+
input_ids = tokenizer(full_prompt, return_tensors="pt").to("cpu") # または .to("cuda") / .to("mps") / .to("cpu") に変更
|
54 |
with torch.no_grad():
|
55 |
output_ids = llm.generate(input_ids, max_new_tokens=256)
|
56 |
result_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|