Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe #26

Merged
merged 3 commits into from
Sep 26, 2024
Merged

Safe #26

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions torchtitan/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def __init__(self):
default=True,
action="store_true",
help="Whether to apply loss parallel when sequence parallel is enabled",
)
self.parser.add_argument(
"--training.representation_type",
default="SMILES",
help="The representation type of the molecule for training the model.",
)
self.parser.add_argument(
"--experimental.enable_async_tensor_parallel",
Expand Down
4 changes: 3 additions & 1 deletion torchtitan/datasets/hf_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(
dataset_path: Optional[str],
data_processing_style: str,
tokenizer: Tokenizer,
representation_type: str = "SMILES",
seq_len: int = 2048,
world_size: int = 1,
rank: int = 0,
Expand Down Expand Up @@ -133,6 +134,7 @@ def __init__(
self._tokenizer = tokenizer
self.seq_len = seq_len
self.infinite = infinite
self.representation_type = representation_type
self.rank = rank
self.world_size = world_size

Expand All @@ -142,7 +144,6 @@ def __init__(
else:
self.store = None


# variables for checkpointing
self._sample_idx = 0
self._all_tokens: List[int] = []
Expand Down Expand Up @@ -255,6 +256,7 @@ def build_hf_data_loader(
seq_len: int,
world_size,
rank,
representation_type,
infinite: bool = True,
pin_memory: bool = False,
num_workers: int = 2,
Expand Down
4 changes: 2 additions & 2 deletions torchtitan/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def load_jsonl_line(jsonl_line):
raise ValueError(f"Error decoding JSON: {e}")


def chemlactica_style_data_processing(sample_json, rng):
def chemlactica_style_data_processing(sample_json, rng, representation_type):
try:
sample_json = json.loads(sample_json["text"])
compound = delete_empty_tags(sample_json)
sample_json = generate_formatted_string(
compound, rng
compound, rng, representation_type
)
except Exception as e:
print(e)
Expand Down
Loading
Loading