Upload continuous_learning_session.py
Browse files
continuous_learning_session.py
CHANGED
|
@@ -237,11 +237,15 @@ class ContinuousLearningSession:
|
|
| 237 |
current_q = line.split(":", 1)[1].strip()
|
| 238 |
elif line.startswith("A") and ":" in line and current_q:
|
| 239 |
current_a = line.split(":", 1)[1].strip()
|
| 240 |
-
# Validation: Ensure neither Q nor A is empty
|
| 241 |
-
if current_q and current_a:
|
| 242 |
variations.append({"q": current_q, "a": current_a})
|
| 243 |
current_q = None
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
# Fallback: If synthetic generation failed, duplicate original
|
| 246 |
if len(variations) == 1:
|
| 247 |
print(" ⚠️ Synthetic generation failed to produce valid format. Duplicating original.")
|
|
|
|
| 237 |
current_q = line.split(":", 1)[1].strip()
|
| 238 |
elif line.startswith("A") and ":" in line and current_q:
|
| 239 |
current_a = line.split(":", 1)[1].strip()
|
| 240 |
+
# Validation: Ensure neither Q nor A is empty or garbage
|
| 241 |
+
if current_q and current_a and "..." not in current_q and "..." not in current_a:
|
| 242 |
variations.append({"q": current_q, "a": current_a})
|
| 243 |
current_q = None
|
| 244 |
|
| 245 |
+
# Cleanup Memory
|
| 246 |
+
del inputs, out_ids
|
| 247 |
+
torch.cuda.empty_cache()
|
| 248 |
+
|
| 249 |
# Fallback: If synthetic generation failed, duplicate original
|
| 250 |
if len(variations) == 1:
|
| 251 |
print(" ⚠️ Synthetic generation failed to produce valid format. Duplicating original.")
|