mjkmain commited on
Commit
0e6d989
1 Parent(s): d8ef083

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Trained : Reconstruction tokens
2
+
3
+ ```python
4
+ import torch
5
+
6
+ from safetensors.torch import load_file
7
+ from huggingface_hub import hf_hub_download
8
+
9
+ from semo_lm.model import SemoLlama
10
+ from semo_lm.semo_utils.prefix_vars import PAD_TOKEN_ID
11
+
12
+ model = SemoLlama.from_pretrained(
13
+ "meta-llama/Meta-Llama-3-8B-Instruct",
14
+ torch_dtype=torch.bfloat16,
15
+ pad_token_id=PAD_TOKEN_ID
16
+ )
17
+
18
+ model.init_sentence_encoder_weights()
19
+
20
+ repo_id = "MLP-SEMO/Llama-Reconstruction-embedding"
21
+ filename = "embed_tokens.safetensors"
22
+
23
+ downloaded_file = hf_hub_download(repo_id=repo_id, filename=filename)
24
+ embedding_weights = load_file(downloaded_file)
25
+ model.model.embed_tokens.load_state_dict(embedding_weights)
26
+ ```