Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting LmHead and Embedding Layers for Adapters #231

Open
4 tasks
magdyksaleh opened this issue Feb 8, 2024 · 2 comments · May be fixed by #501
Open
4 tasks

Supporting LmHead and Embedding Layers for Adapters #231

magdyksaleh opened this issue Feb 8, 2024 · 2 comments · May be fixed by #501
Assignees
Labels
enhancement New feature or request

Comments

@magdyksaleh
Copy link
Collaborator

System Info

Doesn't work if you make changes to the vocab

Information

  • Docker
  • The CLI directly

Tasks

  • An officially supported command
  • My own modifications

Reproduction

to come

Expected behavior

to come

@tgaddair tgaddair added the enhancement New feature or request label Feb 8, 2024
@arnavgarg1
Copy link
Contributor

Here's a code block also demonstrating what might be needed:

>>> from transformers import AutoTokenizer, AutoModelForCausalLM
>>> model = AutoModelForCausalLM.from_pretrained("yujiepan/llama-2-tiny-random")
>>> tokenizer = AutoTokenizer.from_pretrained("yujiepan/llama-2-tiny-random")
>>> model.get_input_embeddings()
Embedding(32000, 8, padding_idx=0)
>>> len(tokenizer.vocab)
32000
>>> tokenizer.add_tokens(['|INST|'])
1
>>> len(tokenizer.vocab)
32001
>>> model.resize_token_embeddings(len(tokenizer.vocab))
Embedding(32001, 8)
>>> model.get_input_embeddings().padding_idx = 0 # Save before and set again after resizing
>>> model.get_input_embeddings()
Embedding(32001, 8, padding_idx=0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants