Skip to content

Commit

Permalink
Merge pull request google#732 from google:mattdavidow-support-simple
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 647752765
  • Loading branch information
maxtext authors committed Jun 28, 2024
2 parents d9138b1 + 1128ed5 commit 93efadf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MaxText/layers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def get_decoder_layer(self):
raise ValueError(f"Incorrect decoder_block name {self.config.decoder_block=}")

def get_norm_layer(self):
if self.config.decoder_block in ("default", "llama2", "mistral", "gemma"):
if self.config.decoder_block in ("default", "llama2", "mistral", "gemma", "simple"):
return RMSNorm
elif self.config.decoder_block == "gpt3":
from layers import gpt3
Expand Down
34 changes: 34 additions & 0 deletions MaxText/tests/simple_decoder_layer_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Copyright 2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import unittest
import pytest
from train import main as train_main


class SimpleDecoderLayerTest(unittest.TestCase):
@pytest.mark.tpu
def test_simple_decoder_layer(self):
train_main([
None,
"configs/base.yml",
r"base_output_directory=gs:https://runner-maxtext-logs",
"run_name=runner_simple_decoder_layer_test",
r"dataset_path=gs:https://maxtext-dataset",
"decoder_block=simple",
"enable_checkpointing=False",
"tokenizer_path=../assets/tokenizer.llama2",
])

if __name__ == "__main__":
unittest.main()

0 comments on commit 93efadf

Please sign in to comment.