Update README.md
Browse files
README.md
CHANGED
|
@@ -63,9 +63,62 @@ if final_tokenizer.pad_token is None:
|
|
| 63 |
final_tokenizer.pad_token = final_tokenizer.eos_token
|
| 64 |
print("Padding token has been set.")
|
| 65 |
|
| 66 |
-
|
| 67 |
# Set the model to evaluation mode
|
| 68 |
final_model.eval()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
## Training procedure
|
|
|
|
| 63 |
final_tokenizer.pad_token = final_tokenizer.eos_token
|
| 64 |
print("Padding token has been set.")
|
| 65 |
|
|
|
|
| 66 |
# Set the model to evaluation mode
|
| 67 |
final_model.eval()
|
| 68 |
+
|
| 69 |
+
# Run Inference
|
| 70 |
+
print("Preparing prompt and running generation...")
|
| 71 |
+
messages = [{"role": "user", "content": "Please suggest me some mindfullness relaxation techniques to overcome the frustration I have when I deal with Triton kernels."}]
|
| 72 |
+
|
| 73 |
+
prompt_string = final_tokenizer.apply_chat_template(
|
| 74 |
+
messages, add_generation_prompt=True, tokenize=False
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
inputs = final_tokenizer(
|
| 78 |
+
prompt_string,
|
| 79 |
+
return_tensors="pt"
|
| 80 |
+
).to(final_model.device)
|
| 81 |
+
|
| 82 |
+
with torch.no_grad():
|
| 83 |
+
outputs = final_model.generate(**inputs, max_new_tokens=512)
|
| 84 |
+
output_ids = outputs[0][len(inputs.input_ids[0]) :]
|
| 85 |
+
|
| 86 |
+
response_text = final_tokenizer.decode(output_ids, skip_special_tokens=True)
|
| 87 |
+
print("\n--- Generated Response ---")
|
| 88 |
+
print(response_text)
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Example text generation:
|
| 92 |
+
|
| 93 |
+
```
|
| 94 |
+
--- Generated Response ---
|
| 95 |
+
1. Mindful breathing: Take a few deep breaths and focus on your breath. Feel the air entering and leaving your body. This can help you calm down and focus on the present moment.
|
| 96 |
+
|
| 97 |
+
2. Body scan: Lie down or sit comfortably and focus on each part of your body, starting from your toes and moving up to your head. Notice any tension or discomfort and try to release it.
|
| 98 |
+
|
| 99 |
+
3. Visualization: Close your eyes and imagine yourself in a peaceful place, such as a beach or forest. Focus on the sights, sounds, and smells around you. This can help you relax and reduce stress.
|
| 100 |
+
|
| 101 |
+
4. Progressive muscle relaxation: Tense and then relax each muscle group in your body, starting from your toes and moving up to your head. This can help you release tension and relax your body.
|
| 102 |
+
|
| 103 |
+
5. Mantra repetition: Repeat a calming phrase or mantra to yourself, such as "I am calm" or "I am relaxed." This can help you focus your mind and reduce stress.
|
| 104 |
+
|
| 105 |
+
6. Walking meditation: Take a slow, mindful walk and focus on each step you take. Notice the feeling of your feet touching the ground and the movement of your legs. This can help you reduce stress and increase mindfulness.
|
| 106 |
+
|
| 107 |
+
7. Yoga: Practice yoga poses that focus on relaxation and mindfulness, such as child's pose, downward facing dog, and savasana. This can help you reduce stress and increase mindfulness.
|
| 108 |
+
|
| 109 |
+
8. Guided meditation: Listen to a guided meditation or relaxation exercise. This can help you focus your mind and reduce stress.
|
| 110 |
+
|
| 111 |
+
9. Mindful eating: Take a few deep breaths and focus on the taste, texture, and smell of your food. This can help you reduce stress and increase mindfulness.
|
| 112 |
+
|
| 113 |
+
10. Nature walk: Take a slow, mindful walk in nature and focus on the sights, sounds, and smells around you. This can help you reduce stress and increase mindfulness.
|
| 114 |
+
|
| 115 |
+
Remember to practice these techniques regularly to reduce stress and increase mindfulness.
|
| 116 |
+
|
| 117 |
+
You can also try using apps such as Headspace, Calm, or Insight Timer to help you practice mindfulness and relaxation techniques. These apps offer guided meditations, breathing exercises, and other mindfulness practices.
|
| 118 |
+
|
| 119 |
+
Remember to be patient and consistent with your practice, and don't be afraid to try different techniques to find what works best for you.
|
| 120 |
+
|
| 121 |
+
You can also try seeking support from a therapist or counselor if you are struggling with
|
| 122 |
```
|
| 123 |
|
| 124 |
## Training procedure
|