Skip to content

Commit a6a030d

Browse files
sguggerraghavanone
authored andcommitted
LLaMA house-keeping (huggingface#22216)
* LLaMA house-keeping * Doc links
1 parent 98613dc commit a6a030d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

docs/source/en/model_doc/llama.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ python src/transformers/models/llama/convert_llama_weights_to_hf.py \
3333
- After conversion, the model and tokenizer can be loaded via:
3434

3535
```python
36-
tokenizer = transformers.LlamaTokenizer.from_pretrained("/output/path/tokenizer/")
37-
model = transformers.LlamaForCausalLM.from_pretrained("/output/path/llama-7b/")
36+
from transformers import LlamaForCausalLM, LlamaTokenizer
37+
38+
tokenizer = LlamaTokenizer.from_pretrained("/output/path/tokenizer/")
39+
model = LlamaForCausalLM.from_pretrained("/output/path/llama-7b/")
3840
```
3941

4042
- The LLaMA tokenizer is based on [sentencepiece](https://github.com/google/sentencepiece). One quirk of sentencepiece is that when decoding a sequence, if the first token is the start of the word (e.g. "Banana"), the tokenizer does not prepend the prefix space to the string. To have the tokenizer output the prefix space, set `decode_with_prefix_space=True` in the `LlamaTokenizer` object or in the tokenizer configuration.

src/transformers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4487,9 +4487,9 @@
44874487
TypicalLogitsWarper,
44884488
top_k_top_p_filtering,
44894489
)
4490+
from .modeling_utils import PreTrainedModel
44904491

44914492
# PyTorch model imports
4492-
from .modeling_utils import PreTrainedModel
44934493
from .models.albert import (
44944494
ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
44954495
AlbertForMaskedLM,

src/transformers/models/llama/configuration_llama.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
class LlamaConfig(PretrainedConfig):
3232
r"""
33-
This is the configuration class to store the configuration of a [`~LlamaModel`]. It is used to instantiate an LLaMA
33+
This is the configuration class to store the configuration of a [`LlamaModel`]. It is used to instantiate an LLaMA
3434
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
3535
defaults will yield a similar configuration to that of the LLaMA-7B.
3636
@@ -41,7 +41,7 @@ class LlamaConfig(PretrainedConfig):
4141
Args:
4242
vocab_size (`int`, *optional*, defaults to 32000):
4343
Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the
44-
`inputs_ids` passed when calling [`~LlamaModel`]
44+
`inputs_ids` passed when calling [`LlamaModel`]
4545
hidden_size (`int`, *optional*, defaults to 4096):
4646
Dimension of the hidden representations.
4747
intermediate_size (`int`, *optional*, defaults to 11008):

0 commit comments

Comments
 (0)