Spaces:
Running on Zero
Running on Zero
Gong Junmin commited on
Commit ·
259f26f
1
Parent(s): da29ff1
fix Qwen3ForCausalLM has no attribute
Browse files
acestep/third_parts/nano-vllm/nanovllm/models/qwen3.py
CHANGED
|
@@ -201,6 +201,20 @@ class Qwen3ForCausalLM(nn.Module):
|
|
| 201 |
if config.tie_word_embeddings:
|
| 202 |
self.lm_head.weight.data = self.model.embed_tokens.weight.data
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
def forward(
|
| 205 |
self,
|
| 206 |
input_ids: torch.Tensor,
|
|
|
|
| 201 |
if config.tie_word_embeddings:
|
| 202 |
self.lm_head.weight.data = self.model.embed_tokens.weight.data
|
| 203 |
|
| 204 |
+
# Proxy attributes for weight loading compatibility
|
| 205 |
+
# Some model weights use "embed_tokens" instead of "model.embed_tokens"
|
| 206 |
+
@property
|
| 207 |
+
def embed_tokens(self):
|
| 208 |
+
return self.model.embed_tokens
|
| 209 |
+
|
| 210 |
+
@property
|
| 211 |
+
def layers(self):
|
| 212 |
+
return self.model.layers
|
| 213 |
+
|
| 214 |
+
@property
|
| 215 |
+
def norm(self):
|
| 216 |
+
return self.model.norm
|
| 217 |
+
|
| 218 |
def forward(
|
| 219 |
self,
|
| 220 |
input_ids: torch.Tensor,
|
requirements.txt
CHANGED
|
@@ -8,7 +8,7 @@ torchaudio>=2.9.1; sys_platform != 'win32'
|
|
| 8 |
torchvision; sys_platform != 'win32'
|
| 9 |
|
| 10 |
# Core dependencies
|
| 11 |
-
transformers>=4.51.0
|
| 12 |
diffusers
|
| 13 |
gradio==6.2.0
|
| 14 |
matplotlib>=3.7.5
|
|
|
|
| 8 |
torchvision; sys_platform != 'win32'
|
| 9 |
|
| 10 |
# Core dependencies
|
| 11 |
+
transformers>=4.51.0
|
| 12 |
diffusers
|
| 13 |
gradio==6.2.0
|
| 14 |
matplotlib>=3.7.5
|