ReXeeD commited on
Commit
726ee2d
·
verified ·
1 Parent(s): 8d78061

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -1
README.md CHANGED
@@ -67,4 +67,66 @@ If you ask it to perform a delivery (e.g., *"Fetch my laptop from the server roo
67
  {"type": "nav2", "cmd": "go_to_waypoint", "target": "john_desk"},
68
  {"type": "stunt", "cmd": "full_sit"}
69
  ]
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  {"type": "nav2", "cmd": "go_to_waypoint", "target": "john_desk"},
68
  {"type": "stunt", "cmd": "full_sit"}
69
  ]
70
+ }
71
+
72
+ ```
73
+ ## TEST SCRIPT
74
+ ```
75
+ # ============================================================
76
+ # ============================================================
77
+ from unsloth import FastLanguageModel
78
+ import torch
79
+
80
+ MODEL_PATH = "./tasx_sft_merged"
81
+ MAX_SEQ_LENGTH = 512
82
+
83
+ print("⏳ Loading your fine-tuned TASX model...")
84
+ model, tokenizer = FastLanguageModel.from_pretrained(
85
+ model_name = MODEL_PATH,
86
+ max_seq_length = MAX_SEQ_LENGTH,
87
+ dtype = torch.float16,
88
+ load_in_4bit = False,
89
+ )
90
+
91
+ FastLanguageModel.for_inference(model)
92
+
93
+ print("\n" + "="*50)
94
+ print("TASX ROBOT COMMAND TESTER READY")
95
+ print("Type a command in the box below and press Enter.")
96
+ print("Type 'quit' or 'q' to stop.")
97
+ print("="*50 + "\n")
98
+
99
+
100
+ while True:
101
+ user_text = input("🎤 You: ")
102
+
103
+ if user_text.lower() in ['quit', 'exit', 'q']:
104
+ print("Stopping inference. Great job!")
105
+ break
106
+
107
+ if not user_text.strip():
108
+ continue
109
+
110
+
111
+ prompt = f"<|im_start|>user\n{user_text}<|im_end|>\n<|im_start|>assistant\n"
112
+
113
+
114
+ inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
115
+
116
+ # Generate the output
117
+ outputs = model.generate(
118
+ **inputs,
119
+ max_new_tokens=150,
120
+ use_cache=True,
121
+ temperature=0.1,
122
+ do_sample=True,
123
+ )
124
+
125
+ # Decode the output (slice off the prompt so we only see the assistant's new text)
126
+ response = tokenizer.batch_decode(
127
+ outputs[:, inputs.input_ids.shape[1]:],
128
+ skip_special_tokens=True
129
+ )[0]
130
+
131
+ print(f"TASX: {response.strip()}\n")
132
+ ```