-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add block seq len and attention/activation dtype args to LLM export script #391
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
""" | ||
|
||
from dataclasses import dataclass | ||
from typing import Any, Optional | ||
from typing import Any, Optional, ClassVar | ||
import torch | ||
|
||
__all__ = ["LlamaHParams", "LlamaModelConfig"] | ||
|
@@ -121,7 +121,8 @@ class LlamaModelConfig: | |
|
||
# Block sequence stride for a paged KV cache. This must divide evenly | ||
# into the context length. | ||
block_seq_stride: int = 16 | ||
default_block_seq_stride: ClassVar[int] = 16 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted a way to reference the default from the export script, so that the CLI argument has the same default. |
||
block_seq_stride: int = default_block_seq_stride | ||
|
||
# Either "paged" or "direct". | ||
kv_cache_type: str = "paged" | ||
|
@@ -130,10 +131,12 @@ class LlamaModelConfig: | |
device: Optional[torch.device] = None | ||
|
||
# Dtype to use for general FP activations not otherwise configured. | ||
activation_dtype: torch.dtype = torch.float16 | ||
default_activation_dtype: ClassVar[torch.dtype] = torch.float16 | ||
activation_dtype: torch.dtype = default_activation_dtype | ||
|
||
# Dtype to use for attention. | ||
attention_dtype: torch.dtype = torch.float16 | ||
default_attention_dtype: ClassVar[torch.dtype] = torch.float16 | ||
attention_dtype: torch.dtype = default_attention_dtype | ||
|
||
# How many devices are involved for tensor parallel sharding. | ||
# If greater than 1, the model will expect sharded model parameters and function | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the other PR. It should be included there and not bleed into this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already merged the other PR.