Skip to content

Commit

Permalink
add OPT embedding attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jumelet committed Mar 30, 2023
1 parent b06d692 commit f5d5f07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions diagnnose/models/huggingface_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def embeddings(self) -> Callable[[Tensor], Tensor]:
elif hasattr(base_model, "word_emb"):
# Transformer-XL
return base_model.word_emb
elif hasattr(base_model, "decoder"):
# OPT
return base_model.decoder.embed_tokens
else:
raise AttributeError("word embedding attribute not found")

Expand Down

0 comments on commit f5d5f07

Please sign in to comment.