Delete reason_model.py
Browse files- reason_model.py +0 -19
reason_model.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
import os
|
| 5 |
-
os.environ["HF_HOME"] = "/app/.cache"
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
model_id = "codellama/CodeLlama-7b-Instruct-hf"
|
| 9 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 10 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).cuda()
|
| 11 |
-
|
| 12 |
-
def plan_action(description):
|
| 13 |
-
prompt = f"""You are a 3D sculpt assistant. Based on this visual description:
|
| 14 |
-
\"\"\"{description}\"\"\"
|
| 15 |
-
Write a sculpt brush plan like:
|
| 16 |
-
{{"tool": "clay", "region": "brow", "brush_size": 0.2, "amount": 0.1}}"""
|
| 17 |
-
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 18 |
-
output = model.generate(**inputs, max_new_tokens=256)
|
| 19 |
-
return tokenizer.decode(output[0], skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|