GradientGuru
commited on
Commit
•
43fb20e
1
Parent(s):
bc0679d
Update modeling_baichuan.py
Browse files- modeling_baichuan.py +18 -0
modeling_baichuan.py
CHANGED
@@ -364,6 +364,24 @@ class BaichuanForCausalLM(BaichuanPreTrainedModel):
|
|
364 |
# Initialize weights and apply final processing
|
365 |
self.post_init()
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
def forward(
|
368 |
self,
|
369 |
input_ids: torch.LongTensor = None,
|
|
|
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,
|