Instructions to use Vijayendra/DeepSeek-Qwen2.5-14B-DeepThinker-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Vijayendra/DeepSeek-Qwen2.5-14B-DeepThinker-v2 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1-Distill-Qwen-14B") model = PeftModel.from_pretrained(base_model, "Vijayendra/DeepSeek-Qwen2.5-14B-DeepThinker-v2") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -67,20 +67,35 @@ This evaluation provides a solid foundation for future refinements and improved
|
|
| 67 |
## How to Use
|
| 68 |
|
| 69 |
```python
|
| 70 |
-
!pip install bitsandbytes
|
|
|
|
| 71 |
import torch
|
| 72 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 73 |
|
| 74 |
-
#
|
| 75 |
MODEL_NAME = "Vijayendra/DeepSeek-Qwen2.5-14B-DeepThinker-v2"
|
| 76 |
|
| 77 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
|
|
|
|
|
|
| 79 |
model = AutoModelForCausalLM.from_pretrained(
|
| 80 |
-
MODEL_NAME,
|
| 81 |
-
device_map="auto",
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
# 🛠 **Define Inference Function**
|
| 86 |
def generate_response(model, tokenizer, prompt, max_new_tokens=4096, temperature=0.7):
|
|
@@ -131,6 +146,7 @@ for i, question in enumerate(questions, 1):
|
|
| 131 |
response = generate_response(model, tokenizer, question)
|
| 132 |
print(f"\n🟢 Question {i}: {question}")
|
| 133 |
print(f"🔵 Response: {response}")
|
|
|
|
| 134 |
```
|
| 135 |
|
| 136 |
|
|
|
|
| 67 |
## How to Use
|
| 68 |
|
| 69 |
```python
|
| 70 |
+
!pip install bitsandbytes peft
|
| 71 |
+
|
| 72 |
import torch
|
| 73 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 74 |
|
| 75 |
+
# ✅ Model Name (Your Uploaded Hugging Face Model)
|
| 76 |
MODEL_NAME = "Vijayendra/DeepSeek-Qwen2.5-14B-DeepThinker-v2"
|
| 77 |
|
| 78 |
+
# ✅ 4-bit Quantization Config
|
| 79 |
+
bnb_config = BitsAndBytesConfig(
|
| 80 |
+
load_in_4bit=True,
|
| 81 |
+
bnb_4bit_quant_type="nf4", # You can also try "fp4"
|
| 82 |
+
bnb_4bit_use_double_quant=True,
|
| 83 |
+
bnb_4bit_compute_dtype=torch.float32
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# ✅ Load Tokenizer
|
| 87 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 88 |
+
|
| 89 |
+
# ✅ Load Quantized Model
|
| 90 |
model = AutoModelForCausalLM.from_pretrained(
|
| 91 |
+
MODEL_NAME,
|
| 92 |
+
device_map="auto",
|
| 93 |
+
quantization_config=bnb_config,
|
| 94 |
+
torch_dtype=torch.float16 # Optional but helps with memory
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
print("\n🚀 Model successfully loaded across GPUs! 🚀")
|
| 98 |
+
print(model.hf_device_map)
|
| 99 |
|
| 100 |
# 🛠 **Define Inference Function**
|
| 101 |
def generate_response(model, tokenizer, prompt, max_new_tokens=4096, temperature=0.7):
|
|
|
|
| 146 |
response = generate_response(model, tokenizer, question)
|
| 147 |
print(f"\n🟢 Question {i}: {question}")
|
| 148 |
print(f"🔵 Response: {response}")
|
| 149 |
+
|
| 150 |
```
|
| 151 |
|
| 152 |
|