Skip to content

Commit

Permalink
fix neoxargs usage test
Browse files Browse the repository at this point in the history
  • Loading branch information
AI-WAIFU committed Oct 7, 2024
1 parent 94d31f6 commit 44a2077
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
23 changes: 23 additions & 0 deletions configs/neox_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,29 @@ Model Arguments
- **dim_att**: int
Default = None
Total dimension of the attention mechanism for RWKV. If not set, defaults to hidden_size.
- **head_size**: int
Default = None
Size of each attention head for RWKV. Calculated as dim_att // num_attention_heads.
- **ffn_dim**: int
Default = None
Dimension of the feed-forward network for RWKV. If not set, calculated based on hidden_size and expansion_factor.
## NeoXArgsOptimizer
Optimizer Arguments
Expand Down
19 changes: 17 additions & 2 deletions megatron/neox_arguments/neox_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from template import NeoXArgsTemplate

try:
from typing import List, Literal, Union, Optional
from typing import List, Literal, Union, Optional, Any
except ImportError:
from typing_extensions import List, Literal, Union, Optional

Expand Down Expand Up @@ -502,6 +502,21 @@ class NeoXArgsModel(NeoXArgsTemplate):
Parameter controlling whether the output layer is parallelized over the hidden dim (row) or the vocab dim (column)
"""

dim_att: int = None
"""
Total dimension of the attention mechanism for RWKV. If not set, defaults to hidden_size.
"""

head_size: int = None
"""
Size of each attention head for RWKV. Calculated as dim_att // num_attention_heads.
"""

ffn_dim: int = None
"""
Dimension of the feed-forward network for RWKV. If not set, calculated based on hidden_size and expansion_factor.
"""


@dataclass
class NeoXArgsOptimizer(NeoXArgsTemplate):
Expand Down Expand Up @@ -673,7 +688,7 @@ class NeoXArgsLogging(NeoXArgsTemplate):
Custom metadata to attach to the created Comet Experiment.
"""

comet_experiment = None
comet_experiment: Any = None
"""
Initialized comet experiment object used to log data
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/neox_args/test_neoxargs_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_neoxargs_usage():

# find args matches
matches = list(
re.findall(r"(?<=args\.).{2,}?(?=[\s\n(){}+-/*;:,=,[,\]])", file_contents)
re.findall(r"(?<=neox_args\.).{2,}?(?=[\s\n(){}+-/*;:,=,[,\]])", file_contents)
)
if len(matches) == 0:
continue
Expand Down

0 comments on commit 44a2077

Please sign in to comment.