Skip to content

Commit

Permalink
precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-Anthony committed Sep 9, 2024
1 parent ef32d69 commit 976cd5d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions megatron/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from megatron import mpu, print_rank_0
from megatron.utils import report_memory


class Tee:
"""Duplicate output to both stdout/err and file"""

Expand Down
2 changes: 1 addition & 1 deletion megatron/model/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def __init__(
# skip_bias_add=False,
# mup_rescale_parameters=is_last_layer, # only called if neox_args.use_mup = True, despite it not being included here
# )
else: # Not using cross entropy loss for RMs
else: # Not using cross entropy loss for RMs
self.rm_linear = mpu.RowParallelLinear(
neox_args=neox_args,
input_size=neox_args.hidden_size,
Expand Down
22 changes: 13 additions & 9 deletions megatron/neox_arguments/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
)

### Logging colors ###
GREEN = '\033[92m'
RED = '\033[91m'
YELLOW = '\033[93m'
END = '\033[0m'
GREEN = "\033[92m"
RED = "\033[91m"
YELLOW = "\033[93m"
END = "\033[0m"
SUCCESS = f"{GREEN} [SUCCESS] {END}"
OKAY = f"{GREEN}[OKAY]{END}"
WARNING = f"{YELLOW}[WARNING]{END}"
FAIL = f'{RED}[FAIL]{END}'
INFO = '[INFO]'
FAIL = f"{RED}[FAIL]{END}"
INFO = "[INFO]"

# ZERO defaults by deespeed
# These values should not be changed unless defaults in deepspeed are changed
Expand Down Expand Up @@ -205,11 +205,13 @@ def initialize_comet(self):

logging.info("> setting up comet ...")
except ImportError as e:
logging.error(f"{FAIL} importing comet. Comet can be installed with \"pip install comet_llm\". See https://github.com/comet-ml/comet-llm for more info. Full error is:")
logging.error(
f'{FAIL} importing comet. Comet can be installed with "pip install comet_llm". See https://github.com/comet-ml/comet-llm for more info. Full error is:'
)
raise e
except Exception as e:
logging.error(
f"{FAIL} Error setting up Comet. Either set \"use_comet: False\" in your configuration file, or resolve the issue with Comet. Full error is:",
f'{FAIL} Error setting up Comet. Either set "use_comet: False" in your configuration file, or resolve the issue with Comet. Full error is:',
)
raise e

Expand Down Expand Up @@ -1219,7 +1221,9 @@ def validate_values(self):

# learning rate
if self.lr is None:
error_message = f"{FAIL} " + self.__class__.__name__ + ".validate_values() lr is None"
error_message = (
f"{FAIL} " + self.__class__.__name__ + ".validate_values() lr is None"
)
logging.error(error_message)
raise ValueError(error_message)
return False
Expand Down
2 changes: 1 addition & 1 deletion tools/datasets/preprocess_data_with_chat_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def build_chat(
chat_tokens = tokenizer.apply_chat_template(
chat[: i + 1], add_generation_prompt=add_gen
)[len(tokens) :]

# remove previous stuff...
tokens.extend(chat_tokens)
if only_last_turn and (i != len(chat) - 1):
Expand Down

0 comments on commit 976cd5d

Please sign in to comment.