Skip to content

Commit

Permalink
Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakep-allenai committed Oct 7, 2024
1 parent e973de7 commit 4557a5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pdelfin/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ def run_train(config: TrainConfig):
setup_environment(aws_config=config.aws, wandb_config=config.wandb, WANDB_RUN_GROUP=run_name.group)
accelerator = accelerate.Accelerator()

processor = AutoProcessor.from_pretrained(config.model.name_or_path)

# Build and download the dataset on process 0
if accelerator.is_main_process:
make_dataset(config)
make_dataset(config, processor)

accelerator.wait_for_everyone()

Expand All @@ -128,8 +130,7 @@ def run_train(config: TrainConfig):
config.model.name_or_path, torch_dtype=torch.bfloat16,
_attn_implementation="flash_attention_2" if config.model.use_flash_attn else None
)
processor = AutoProcessor.from_pretrained(config.model.name_or_path)


if config.lora is not None:
peft_config = LoraConfig(
r=config.lora.rank,
Expand Down
3 changes: 2 additions & 1 deletion pdelfin/train/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import torch
import torch.nn.functional as F
from transformers import AutoProcessor
from accelerate import Accelerator
from accelerate.utils import PrecisionType
from datasets import Dataset, concatenate_datasets, DatasetDict
Expand Down Expand Up @@ -41,7 +42,7 @@ def accelerator_to_dtype(accelerator: Accelerator) -> torch.dtype:
return torch.float8_e4m3fn
return torch.float32

def make_dataset(config: TrainConfig) -> tuple[Dataset, Dataset]:
def make_dataset(config: TrainConfig, processor: AutoProcessor) -> tuple[Dataset, Dataset]:
random.seed(config.train_data.seed)

# Training sets get all concatenated and shuffled
Expand Down

0 comments on commit 4557a5b

Please sign in to comment.