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

[Train] Add example of pre-training Llama model on Intel Gaudi #45459

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

harborn
Copy link
Contributor

@harborn harborn commented May 21, 2024

Why are these changes needed?

To leverage the potential of Intel Gaudi accelerator, we extend Ray Train's capabilities by adding support for Intel Gaudi (HPU) hardware. This PR include an example for pre-training Llama-7b on multi HPUs.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for train team folks to review)

@anyscalesam anyscalesam added triage Needs triage (eg: priority, bug/not-bug, and owning component) train Ray Train Related Issue labels May 23, 2024
Signed-off-by: Wu, Gangsheng <gangsheng.wu@intel.com>
Signed-off-by: Wu, Gangsheng <gangsheng.wu@intel.com>
Signed-off-by: Wu, Gangsheng <gangsheng.wu@intel.com>
@woshiyyya woshiyyya self-assigned this May 31, 2024
@@ -0,0 +1,568 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High-level question: seems that it's using deepspeed zero-3 for pre-training. why we also include megatron here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example import megatron just for data processing

" )\n",
"\n",
" # Data loader only on rank 0 of each model parallel group.\n",
" if args.use_dataset_only or mpu.get_tensor_model_parallel_rank() == 0:\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did we configure the tensor and pipeline parallel group size?

"(RayTrainWorker pid=339380) {'loss': nan, 'grad_norm': nan, 'learning_rate': 4.9e-05, 'epoch': 0.0, 'memory_allocated (GB)': 40.42, 'max_memory_allocated (GB)': 93.68, 'total_memory_available (GB)': 94.62}\n",
"(RayTrainWorker pid=339380) {'loss': nan, 'grad_norm': nan, 'learning_rate': 4.875e-05, 'epoch': 0.0, 'memory_allocated (GB)': 40.4, 'max_memory_allocated (GB)': 93.68, 'total_memory_available (GB)': 94.62}\n",
"(RayTrainWorker pid=339380) {'loss': nan, 'grad_norm': nan, 'learning_rate': 4.85e-05, 'epoch': 0.0, 'memory_allocated (GB)': 40.4, 'max_memory_allocated (GB)': 93.68, 'total_memory_available (GB)': 94.62}\n",
"(RayTrainWorker pid=339380) {'loss': nan, 'grad_norm': nan, 'learning_rate': 4.825e-05, 'epoch': 0.0, 'memory_allocated (GB)': 40.45, 'max_memory_allocated (GB)': 93.68, 'total_memory_available (GB)': 94.62}\n",
Copy link
Member

@woshiyyya woshiyyya May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that the loss and grad norm are nan, can you try to fix the bug?

"\n",
" # Set backend to hccl in TorchConfig\n",
" torch_config = TorchConfig(backend=\"hccl\")\n",
" runtime_env = {\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this if it's empty

"cell_type": "markdown",
"metadata": {},
"source": [
"## Process dataset to dataloader"
Copy link
Member

@woshiyyya woshiyyya May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, can we introduce the model sharding layouts, so that the users can better understand why the dataloader is defined this?

Including pp/tp/dp group size, global batch size, per device batch size, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
train Ray Train Related Issue triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants