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

Yash/dev llava next #10749

Closed
wants to merge 99 commits into from
Closed

Yash/dev llava next #10749

wants to merge 99 commits into from

Conversation

yashaswikarnati
Copy link
Collaborator

What does this PR do ?

Support training of LLaVa NeXt model.

Collection: [Note which collection this PR will affect]
Multimodal

Changelog

  • Added necessary task encoders for energon data module to support training LLaVA NeXT with NeVA Model

Usage

The only change is to use the energon based data module as shown below with existing NeVA model

from nemo.collections.multimodal.data.energon.config import MultiModalSampleConfig
from nemo.collections.vlm import LlavaNextTaskEncoder
from nemo.collections.multimodal.data.energon import SimpleMultiModalDataModule
from transformers import AutoProcessor
processor = AutoProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
    data_path = args.data_path
    image_processor = processor.image_processor
    tokenizer = processor.tokenizer

    multimodal_sample_config = MultiModalSampleConfig()

    task_encoder = LlavaNextTaskEncoder(
        tokenizer=tokenizer, image_processor=image_processor, multimodal_sample_config=multimodal_sample_config
    )
    data = SimpleMultiModalDataModule(
        path=data_path,
        tokenizer=tokenizer,
        image_processor=image_processor,
        num_workers=8,
        micro_batch_size=mbs,
        global_batch_size=gbs,
        multimodal_sample_config=multimodal_sample_config,
        task_encoder=task_encoder,
    )

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@yashaswikarnati
Copy link
Collaborator Author

https://wandb.ai/joc/llava_next_energon/runs/70551i0j?nw=nwuserykarnati - fine tuning convergence run on LLaVA dataset

@@ -0,0 +1,161 @@
import argparse
import os

Check notice

Code scanning / CodeQL

Unused import

Import of 'os' is not used.
@@ -0,0 +1,161 @@
import argparse
import os
import sys

Check notice

Code scanning / CodeQL

Unused import

Import of 'sys' is not used.
import os
import sys

import requests

Check notice

Code scanning / CodeQL

Unused import

Import of 'requests' is not used.
import requests
import torch
from megatron.core.optimizer import OptimizerConfig
from megatron.energon import VQASample

Check notice

Code scanning / CodeQL

Unused import

Import of 'VQASample' is not used.
import torch
from megatron.core.optimizer import OptimizerConfig
from megatron.energon import VQASample
from PIL import Image

Check notice

Code scanning / CodeQL

Unused import

Import of 'Image' is not used.
from nemo.collections import llm, vlm
from nemo.collections.multimodal.data.energon import SimpleMultiModalDataModule
from nemo.collections.multimodal.data.energon.config import MultiModalSampleConfig
from nemo.collections.vlm import ImageDataConfig, Llava1_5Config7B, LlavaModel, LlavaNextTaskEncoder

Check notice

Code scanning / CodeQL

Unused import

Import of 'ImageDataConfig' is not used. Import of 'Llava1_5Config7B' is not used. Import of 'LlavaModel' is not used.
from nemo.collections.vlm import ImageDataConfig, Llava1_5Config7B, LlavaModel, LlavaNextTaskEncoder
from nemo.lightning.pytorch.optim import CosineAnnealingScheduler
from nemo.lightning.pytorch.optim.megatron import MegatronOptimizerModule
from nemo.utils import logging

Check notice

Code scanning / CodeQL

Unused import

Import of 'logging' is not used.
# Global and micro batch sizes
gbs = 32
mbs = 4
seq_length = 256

Check notice

Code scanning / CodeQL

Unused local variable

Variable seq_length is not used.
from nemo.collections import llm, vlm
from nemo.collections.multimodal.data.energon import SimpleMultiModalDataModule
from nemo.collections.multimodal.data.energon.config import MultiModalSampleConfig
from nemo.collections.vlm import ImageDataConfig, LlavaNextTaskEncoder

Check notice

Code scanning / CodeQL

Unused import

Import of 'ImageDataConfig' is not used.
# Global and micro batch sizes
gbs = 128
mbs = 4
seq_length = 4096

Check notice

Code scanning / CodeQL

Unused local variable

Variable seq_length is not used.
akoumpa and others added 16 commits October 24, 2024 14:42
* Mixtral TP8 EP1

Signed-off-by: Alexandros Koumparoulis <[email protected]>

* Apply isort and black reformatting

Signed-off-by: akoumpa <[email protected]>

---------

Signed-off-by: Alexandros Koumparoulis <[email protected]>
Signed-off-by: akoumpa <[email protected]>
Co-authored-by: akoumpa <[email protected]>
Signed-off-by: yashaswikarnati <[email protected]>
Signed-off-by: yashaswikarnati <[email protected]>
Signed-off-by: yashaswikarnati <[email protected]>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pablo-garay <[email protected]>
Signed-off-by: yashaswikarnati <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.