Skip to content

Commit

Permalink
Add from-copilot.py which is referenced in notes
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bevenius <[email protected]>
  • Loading branch information
danbev committed Sep 7, 2023
1 parent 5f022c5 commit 7225d1b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions embeddings/python/src/from-copilot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
model = AutoModel.from_pretrained("bert-base-cased")
input_ids = tokenizer("cat", return_tensors="pt")["input_ids"]
embeddings = model(input_ids)[0]
print(f'{embeddings.shape=}')
print(f'{embeddings=}')

0 comments on commit 7225d1b

Please sign in to comment.