Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobfulano committed Jan 5, 2024
1 parent 329ed51 commit 95a4753
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions examples/benchmarks/bert/src/bert_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
IMPL_USE_FLASH2 = False
# Import Flash Attention 2, which supports ALiBi https://github.com/Dao-AILab/flash-attention
try:
from flash_attn import flash_attn_qkvpacked_func # type: ignore
installed_version = importlib.metadata.version('flash_attn') # type: ignore
from flash_attn import flash_attn_qkvpacked_func # type: ignore
installed_version = importlib.metadata.version('flash_attn') # type: ignore
if installed_version < '2.4.2':
raise ImportError('newer version of flash_attn required (>= 2.4.2)')
IMPL_USE_FLASH2 = True
Expand Down Expand Up @@ -278,7 +278,7 @@ def forward(self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor,

attention = flash_attn_qkvpacked_func(
qkv, dropout_p=self.p_dropout, alibi_slopes=slopes)
attention = attention.to(orig_dtype) # type: ignore
attention = attention.to(orig_dtype) # type: ignore
bias = bias.to(bias_dtype)
else:
attention = flash_attn_qkvpacked_func(
Expand All @@ -302,14 +302,14 @@ def forward(self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor,
bias_dtype = bias.dtype
bias = bias.to(half)
attention = flash_attn_qkvpacked_func(qkv, bias)
attention = attention.to(orig_dtype) # type: ignore
attention = attention.to(orig_dtype) # type: ignore
bias = bias.to(bias_dtype)
else:
attention = flash_attn_qkvpacked_func(qkv, bias)

# attn_mask is 1 for attend and 0 for don't attend
attention = bert_padding_module.unpad_input_only(
attention, # type: ignore
attention, # type: ignore
torch.squeeze(attn_mask) == 1)
return rearrange(attention, 'nnz h d -> nnz (h d)')

Expand Down
1 change: 0 additions & 1 deletion examples/end-to-end-examples/support_chatbot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Copyright 2022 MosaicML Examples authors
# SPDX-License-Identifier: Apache-2.0

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ integrations:
# Clone the examples repository so that we have access to the code in sec_10k_qa
- integration_type: git_repo
git_repo: YOUR_GITHUB_USERNAME/examples
#git_branch: support-bot
# git_branch: support-bot
ssh_clone: false # Should be true if using a private repo
path: /workspace/examples # Tell MCLI what path to clone the repo to

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compute:

## These configurations are optional
# cluster: r0z0 # Name of the cluster to use for this run
#gpu_type: h100_80gb # Type of GPU to use.
# gpu_type: h100_80gb # Type of GPU to use.

integrations:
# Clone and install the llm-foundry repo so we can run scripts from it
Expand All @@ -25,7 +25,7 @@ command: |
cd llm-foundry/scripts
composer train/train.py /mnt/config/parameters.yaml || (echo "Command failed - killing python" && pkill python && exit 1)
#image: "mosaicml/llm-foundry:2.0.1_cu118-latest"
# image: "mosaicml/llm-foundry:2.0.1_cu118-latest"
image: mosaicml/pytorch:1.13.1_cu117-python3.10-ubuntu20.04

# The parameters section is mounted to /mnt/config/parameters.yaml in the container
Expand Down Expand Up @@ -60,7 +60,7 @@ parameters:
model:
name: hf_causal_lm
init_device: mixed # Initially only create the model on CPU once per node to reduce system memory requirements
pretrained_model_name_or_path: mosaicml/mpt-30b-chat # This can be changed to other models from the HuggingFace model hub
pretrained_model_name_or_path: mosaicml/mpt-30b-chat # This can be changed to other HF models
pretrained: true # If false, will just load the model architecture and randomly initialize the weights
config_overrides: # Override the default model config (comment this out if you change the model from MPT)
attn_config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ def prepare_output_file(self, file_path: str) -> str:
return output_file

def file_to_txt(self, file_path: (str)) -> None:
"""Given the file_path of a file in cloned repository, downloads it to a
"""Given the file_path of a file in cloned repository, downloads it to
a.
.txt file and saves it in the same directory structure in.
/scripts/train/support_chatbot/retrieval_data/{self.repo_name}
Expand Down

0 comments on commit 95a4753

Please sign in to comment.