GradientGuru
commited on
Commit
•
f5f47be
1
Parent(s):
8ea18eb
Update modeling_baichuan.py
Browse files- modeling_baichuan.py +18 -0
modeling_baichuan.py
CHANGED
@@ -363,7 +363,25 @@ class BaichuanForCausalLM(BaichuanPreTrainedModel):
|
|
363 |
|
364 |
# Initialize weights and apply final processing
|
365 |
self.post_init()
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
def forward(
|
368 |
self,
|
369 |
input_ids: torch.LongTensor = None,
|
|
|
363 |
|
364 |
# Initialize weights and apply final processing
|
365 |
self.post_init()
|
366 |
+
|
367 |
+
def get_input_embeddings(self):
|
368 |
+
return self.model.embed_tokens
|
369 |
+
|
370 |
+
def set_input_embeddings(self, value):
|
371 |
+
self.model.embed_tokens = value
|
372 |
|
373 |
+
def get_output_embeddings(self):
|
374 |
+
return self.lm_head
|
375 |
+
|
376 |
+
def set_output_embeddings(self, new_embeddings):
|
377 |
+
self.lm_head = new_embeddings
|
378 |
+
|
379 |
+
def set_decoder(self, decoder):
|
380 |
+
self.model = decoder
|
381 |
+
|
382 |
+
def get_decoder(self):
|
383 |
+
return self.model
|
384 |
+
|
385 |
def forward(
|
386 |
self,
|
387 |
input_ids: torch.LongTensor = None,
|