From 616dbe7fa8aff0338a0bd55a0d870bc537d74c94 Mon Sep 17 00:00:00 2001 From: Ligeng Zhu Date: Fri, 26 Jul 2024 08:05:00 +0800 Subject: [PATCH] Add License for LongVILA Legal (#143) --- CIs/license_all.sh | 2 +- convert_ckpt.py | 16 ++++++++++++++++ data_prepare/coyo/coyo_downloader.py | 16 ++++++++++++++++ data_prepare/coyo/coyo_splitter.py | 16 ++++++++++++++++ data_prepare/mmc4/mmc4_downloader.py | 16 ++++++++++++++++ data_prepare/mmc4/mmc4_filter_and_counter.py | 16 ++++++++++++++++ data_prepare/mmc4/mmc4_merger.py | 16 ++++++++++++++++ data_prepare/sft/merge_idefics2.py | 16 ++++++++++++++++ data_prepare/sft/preprocess_flan.py | 16 ++++++++++++++++ data_prepare/sft/preprocess_idefics2.py | 16 ++++++++++++++++ data_prepare/sft/preprocess_m3it.py | 16 ++++++++++++++++ data_prepare/sft/split_vflan.py | 16 ++++++++++++++++ llava/3rd_party/gemini_video.py | 16 ++++++++++++++++ llava/3rd_party/gpt4v_nvhost_video.py | 16 ++++++++++++++++ llava/data/dataset_impl/coyo_recap.py | 16 ++++++++++++++++ llava/data/dataset_impl/general_img_text.py | 16 ++++++++++++++++ llava/data/dataset_impl/hiertext.py | 16 ++++++++++++++++ llava/data/dataset_impl/panda70m.py | 16 ++++++++++++++++ llava/data/dataset_impl/sam copy.py | 16 ++++++++++++++++ llava/data/dataset_impl/sam.py | 16 ++++++++++++++++ llava/data/dataset_impl/textocr.py | 16 ++++++++++++++++ llava/data/dataset_tar.py | 16 ++++++++++++++++ llava/data/datasets_mixture.py | 16 ++++++++++++++++ llava/data/simple_video_dataset.py | 16 ++++++++++++++++ llava/data/simple_vila_webdataset.py | 16 ++++++++++++++++ llava/data/utils.py | 16 ++++++++++++++++ llava/data_aug/caption2qa.py | 16 ++++++++++++++++ llava/data_aug/dev.py | 16 ++++++++++++++++ llava/data_aug/reformat_tar.py | 16 ++++++++++++++++ llava/data_aug/video_eval.py | 16 ++++++++++++++++ llava/data_aug/video_inference.py | 16 ++++++++++++++++ llava/model/apply_delta.py | 16 ++++++++++++++++ llava/model/configuration_llava.py | 16 ++++++++++++++++ llava/model/consolidate.py | 16 ++++++++++++++++ llava/model/language_model/builder.py | 16 ++++++++++++++++ .../model/language_model/mpt/adapt_tokenizer.py | 16 ++++++++++++++++ llava/model/language_model/mpt/attention.py | 16 ++++++++++++++++ llava/model/language_model/mpt/blocks.py | 16 ++++++++++++++++ .../language_model/mpt/configuration_mpt.py | 16 ++++++++++++++++ .../model/language_model/mpt/custom_embedding.py | 16 ++++++++++++++++ .../language_model/mpt/flash_attn_triton.py | 16 ++++++++++++++++ .../language_model/mpt/hf_prefixlm_converter.py | 16 ++++++++++++++++ .../language_model/mpt/meta_init_context.py | 16 ++++++++++++++++ llava/model/language_model/mpt/modeling_mpt.py | 16 ++++++++++++++++ llava/model/language_model/mpt/norm.py | 16 ++++++++++++++++ llava/model/language_model/mpt/param_init_fns.py | 16 ++++++++++++++++ llava/model/make_delta.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/builder.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/clip_encoder.py | 16 ++++++++++++++++ .../multimodal_encoder/intern/flash_attention.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/intern_encoder.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/radio_encoder.py | 16 ++++++++++++++++ .../multimodal_encoder/radio_torchhub_encoder.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/siglip_encoder.py | 16 ++++++++++++++++ llava/model/multimodal_encoder/vision_encoder.py | 16 ++++++++++++++++ .../model/multimodal_projector/base_projector.py | 16 ++++++++++++++++ llava/model/multimodal_projector/builder.py | 16 ++++++++++++++++ llava/train/llama_dpsp_attn_monkey_patch.py | 16 ++++++++++++++++ llava/train/sequence_parallel/globals.py | 16 ++++++++++++++++ llava/train/sequence_parallel/hybrid_attn.py | 16 ++++++++++++++++ llava/train/sequence_parallel/input_utils.py | 16 ++++++++++++++++ llava/train/sequence_parallel/monkey_patch.py | 16 ++++++++++++++++ .../sequence_parallel/ring/ring_flash_attn.py | 16 ++++++++++++++++ .../ring/ring_flash_attn_varlen.py | 16 ++++++++++++++++ .../sequence_parallel/ring/stripe_flash_attn.py | 16 ++++++++++++++++ .../train/sequence_parallel/ring/triton_utils.py | 16 ++++++++++++++++ llava/train/sequence_parallel/ring/utils.py | 16 ++++++++++++++++ .../ring/zigzag_ring_flash_attn.py | 16 ++++++++++++++++ .../ring/zigzag_ring_flash_attn_varlen.py | 16 ++++++++++++++++ llava/train/short_video_filter.py | 16 ++++++++++++++++ llava/train/slurm_utils.py | 16 ++++++++++++++++ llava/train/utils.py | 16 ++++++++++++++++ llava/trl/extras/best_of_n_sampler.py | 16 ++++++++++++++++ llava/trl/extras/dataset_formatting.py | 16 ++++++++++++++++ llava/trl/models/utils.py | 16 ++++++++++++++++ llava/trl/trainer/ddpo_config.py | 16 ++++++++++++++++ llava/trl/trainer/model_config.py | 16 ++++++++++++++++ llava/utils/tokenizer.py | 16 ++++++++++++++++ scripts/v1_5/eval/compute_accuracy.py | 16 ++++++++++++++++ scripts/v1_5/eval/convert_pred_to_csv.py | 16 ++++++++++++++++ tests/python/_test_dataset.py | 16 ++++++++++++++++ tests/python/test_llava_arch.py | 16 ++++++++++++++++ tests/python/test_loading.py | 16 ++++++++++++++++ tests/python/test_packing.py | 16 ++++++++++++++++ tests/python/test_preprocess_multimodal.py | 16 ++++++++++++++++ tests/python/test_projector.py | 16 ++++++++++++++++ tests/python/test_rope_scaling.py | 16 ++++++++++++++++ tests/python/test_set_grads.py | 16 ++++++++++++++++ tests/python/test_sp_ulysses_attn.py | 16 ++++++++++++++++ tests/python/test_tokenizer_utils.py | 16 ++++++++++++++++ upload2hf.py | 16 ++++++++++++++++ 91 files changed, 1441 insertions(+), 1 deletion(-) diff --git a/CIs/license_all.sh b/CIs/license_all.sh index c0353839..6ddbb43e 100644 --- a/CIs/license_all.sh +++ b/CIs/license_all.sh @@ -1 +1 @@ -addlicense -s -c 'NVIDIA CORPORATION & AFFILIATES' -ignore "llava/eval/**" -ignore "**/*__init__.py" **/*.py +addlicense -s -c 'NVIDIA CORPORATION & AFFILIATES' -ignore "llava/eval/**" -ignore "llava/wids/**" -ignore "**/*__init__.py" **/*.py diff --git a/convert_ckpt.py b/convert_ckpt.py index aee5567c..46c886b0 100644 --- a/convert_ckpt.py +++ b/convert_ckpt.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os.path as osp from collections import OrderedDict diff --git a/data_prepare/coyo/coyo_downloader.py b/data_prepare/coyo/coyo_downloader.py index f1636692..14f46c2c 100644 --- a/data_prepare/coyo/coyo_downloader.py +++ b/data_prepare/coyo/coyo_downloader.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import asyncio import base64 import os diff --git a/data_prepare/coyo/coyo_splitter.py b/data_prepare/coyo/coyo_splitter.py index 27cdc568..18ac6e14 100644 --- a/data_prepare/coyo/coyo_splitter.py +++ b/data_prepare/coyo/coyo_splitter.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import pickle diff --git a/data_prepare/mmc4/mmc4_downloader.py b/data_prepare/mmc4/mmc4_downloader.py index 13d7283d..17147f39 100644 --- a/data_prepare/mmc4/mmc4_downloader.py +++ b/data_prepare/mmc4/mmc4_downloader.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import asyncio import base64 import json diff --git a/data_prepare/mmc4/mmc4_filter_and_counter.py b/data_prepare/mmc4/mmc4_filter_and_counter.py index 9c0f8182..6bfd3b82 100644 --- a/data_prepare/mmc4/mmc4_filter_and_counter.py +++ b/data_prepare/mmc4/mmc4_filter_and_counter.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import io import json import os diff --git a/data_prepare/mmc4/mmc4_merger.py b/data_prepare/mmc4/mmc4_merger.py index 23e6ca75..d9a0dde3 100644 --- a/data_prepare/mmc4/mmc4_merger.py +++ b/data_prepare/mmc4/mmc4_merger.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import pickle diff --git a/data_prepare/sft/merge_idefics2.py b/data_prepare/sft/merge_idefics2.py index c36bf677..d59e1fd1 100644 --- a/data_prepare/sft/merge_idefics2.py +++ b/data_prepare/sft/merge_idefics2.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os diff --git a/data_prepare/sft/preprocess_flan.py b/data_prepare/sft/preprocess_flan.py index ea42074f..efde19b3 100644 --- a/data_prepare/sft/preprocess_flan.py +++ b/data_prepare/sft/preprocess_flan.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import pickle diff --git a/data_prepare/sft/preprocess_idefics2.py b/data_prepare/sft/preprocess_idefics2.py index 4dbefe2a..6657c91d 100644 --- a/data_prepare/sft/preprocess_idefics2.py +++ b/data_prepare/sft/preprocess_idefics2.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import pickle diff --git a/data_prepare/sft/preprocess_m3it.py b/data_prepare/sft/preprocess_m3it.py index 47e5b847..19b16a2f 100644 --- a/data_prepare/sft/preprocess_m3it.py +++ b/data_prepare/sft/preprocess_m3it.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import pickle diff --git a/data_prepare/sft/split_vflan.py b/data_prepare/sft/split_vflan.py index 572cc1c0..93d0715f 100644 --- a/data_prepare/sft/split_vflan.py +++ b/data_prepare/sft/split_vflan.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import pickle import random diff --git a/llava/3rd_party/gemini_video.py b/llava/3rd_party/gemini_video.py index 39550ef4..eab9d691 100644 --- a/llava/3rd_party/gemini_video.py +++ b/llava/3rd_party/gemini_video.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import glob import json diff --git a/llava/3rd_party/gpt4v_nvhost_video.py b/llava/3rd_party/gpt4v_nvhost_video.py index 937acf7b..6322d78b 100644 --- a/llava/3rd_party/gpt4v_nvhost_video.py +++ b/llava/3rd_party/gpt4v_nvhost_video.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + ### This is the updated script that people should use ### ###TESTED to work with updated OpenAI APIs#### ###Please note create() / AzureOpenAI() instance creation ### diff --git a/llava/data/dataset_impl/coyo_recap.py b/llava/data/dataset_impl/coyo_recap.py index d8e67547..193d433d 100755 --- a/llava/data/dataset_impl/coyo_recap.py +++ b/llava/data/dataset_impl/coyo_recap.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import io diff --git a/llava/data/dataset_impl/general_img_text.py b/llava/data/dataset_impl/general_img_text.py index a5ada3ca..76a1c660 100644 --- a/llava/data/dataset_impl/general_img_text.py +++ b/llava/data/dataset_impl/general_img_text.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import io diff --git a/llava/data/dataset_impl/hiertext.py b/llava/data/dataset_impl/hiertext.py index e54b360d..8e95d97b 100755 --- a/llava/data/dataset_impl/hiertext.py +++ b/llava/data/dataset_impl/hiertext.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # refernced from https://github.com/CVC-DAG/OCR_datasets/blob/master/src/datasets/ocr/hiertext.py import base64 import copy diff --git a/llava/data/dataset_impl/panda70m.py b/llava/data/dataset_impl/panda70m.py index e7720e4d..5e9fcc1c 100755 --- a/llava/data/dataset_impl/panda70m.py +++ b/llava/data/dataset_impl/panda70m.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import glob diff --git a/llava/data/dataset_impl/sam copy.py b/llava/data/dataset_impl/sam copy.py index 49791120..fa030205 100755 --- a/llava/data/dataset_impl/sam copy.py +++ b/llava/data/dataset_impl/sam copy.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import io diff --git a/llava/data/dataset_impl/sam.py b/llava/data/dataset_impl/sam.py index 49791120..fa030205 100755 --- a/llava/data/dataset_impl/sam.py +++ b/llava/data/dataset_impl/sam.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import io diff --git a/llava/data/dataset_impl/textocr.py b/llava/data/dataset_impl/textocr.py index ac2ab317..c6803b68 100755 --- a/llava/data/dataset_impl/textocr.py +++ b/llava/data/dataset_impl/textocr.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import base64 import copy import io diff --git a/llava/data/dataset_tar.py b/llava/data/dataset_tar.py index b5366856..babd4884 100755 --- a/llava/data/dataset_tar.py +++ b/llava/data/dataset_tar.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import glob import hashlib import json diff --git a/llava/data/datasets_mixture.py b/llava/data/datasets_mixture.py index 0decb2d1..d04441c1 100755 --- a/llava/data/datasets_mixture.py +++ b/llava/data/datasets_mixture.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import warnings from dataclasses import dataclass, field diff --git a/llava/data/simple_video_dataset.py b/llava/data/simple_video_dataset.py index c96a85f7..ef3a2758 100755 --- a/llava/data/simple_video_dataset.py +++ b/llava/data/simple_video_dataset.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import argparse import base64 import getpass diff --git a/llava/data/simple_vila_webdataset.py b/llava/data/simple_vila_webdataset.py index eae27cc5..60b41dda 100755 --- a/llava/data/simple_vila_webdataset.py +++ b/llava/data/simple_vila_webdataset.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import argparse import base64 import getpass diff --git a/llava/data/utils.py b/llava/data/utils.py index c311d366..9572f530 100755 --- a/llava/data/utils.py +++ b/llava/data/utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import io import pathlib diff --git a/llava/data_aug/caption2qa.py b/llava/data_aug/caption2qa.py index 63bff789..038182f8 100755 --- a/llava/data_aug/caption2qa.py +++ b/llava/data_aug/caption2qa.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import os.path as osp diff --git a/llava/data_aug/dev.py b/llava/data_aug/dev.py index 12a441a6..b4ca5c6c 100755 --- a/llava/data_aug/dev.py +++ b/llava/data_aug/dev.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os import os.path as osp diff --git a/llava/data_aug/reformat_tar.py b/llava/data_aug/reformat_tar.py index 74623ca5..8527df81 100755 --- a/llava/data_aug/reformat_tar.py +++ b/llava/data_aug/reformat_tar.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import os.path as osp import shutil diff --git a/llava/data_aug/video_eval.py b/llava/data_aug/video_eval.py index 18fd57f8..52ee47b9 100644 --- a/llava/data_aug/video_eval.py +++ b/llava/data_aug/video_eval.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ import argparse diff --git a/llava/data_aug/video_inference.py b/llava/data_aug/video_inference.py index 63b31281..6eb25c4b 100755 --- a/llava/data_aug/video_inference.py +++ b/llava/data_aug/video_inference.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ import argparse diff --git a/llava/model/apply_delta.py b/llava/model/apply_delta.py index ca2804dd..1b547539 100755 --- a/llava/model/apply_delta.py +++ b/llava/model/apply_delta.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ """ diff --git a/llava/model/configuration_llava.py b/llava/model/configuration_llava.py index 8d10e343..61d1afc5 100755 --- a/llava/model/configuration_llava.py +++ b/llava/model/configuration_llava.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from transformers import PretrainedConfig diff --git a/llava/model/consolidate.py b/llava/model/consolidate.py index 3ef1805d..2e86ed17 100755 --- a/llava/model/consolidate.py +++ b/llava/model/consolidate.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """ Usage: python3 -m llava.model.consolidate --src ~/model_weights/llava-7b --dst ~/model_weights/llava-7b_consolidate diff --git a/llava/model/language_model/builder.py b/llava/model/language_model/builder.py index b459e825..4b589a06 100755 --- a/llava/model/language_model/builder.py +++ b/llava/model/language_model/builder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import math import os.path as osp import warnings diff --git a/llava/model/language_model/mpt/adapt_tokenizer.py b/llava/model/language_model/mpt/adapt_tokenizer.py index e669fd52..af15fef3 100755 --- a/llava/model/language_model/mpt/adapt_tokenizer.py +++ b/llava/model/language_model/mpt/adapt_tokenizer.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from typing import Union from transformers import AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerFast diff --git a/llava/model/language_model/mpt/attention.py b/llava/model/language_model/mpt/attention.py index fa63b5be..75316975 100755 --- a/llava/model/language_model/mpt/attention.py +++ b/llava/model/language_model/mpt/attention.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """Attention layers.""" import math import warnings diff --git a/llava/model/language_model/mpt/blocks.py b/llava/model/language_model/mpt/blocks.py index bc631b52..5775fd08 100755 --- a/llava/model/language_model/mpt/blocks.py +++ b/llava/model/language_model/mpt/blocks.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """GPT Blocks used for the GPT Model.""" from typing import Dict, Optional, Tuple diff --git a/llava/model/language_model/mpt/configuration_mpt.py b/llava/model/language_model/mpt/configuration_mpt.py index f90fe10c..a95cbfff 100755 --- a/llava/model/language_model/mpt/configuration_mpt.py +++ b/llava/model/language_model/mpt/configuration_mpt.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """A HuggingFace-style model configuration.""" from typing import Dict, Optional, Union diff --git a/llava/model/language_model/mpt/custom_embedding.py b/llava/model/language_model/mpt/custom_embedding.py index 83979e7e..1721cf13 100755 --- a/llava/model/language_model/mpt/custom_embedding.py +++ b/llava/model/language_model/mpt/custom_embedding.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch import torch.nn as nn import torch.nn.functional as F diff --git a/llava/model/language_model/mpt/flash_attn_triton.py b/llava/model/language_model/mpt/flash_attn_triton.py index cbf5e9a5..e89dd981 100755 --- a/llava/model/language_model/mpt/flash_attn_triton.py +++ b/llava/model/language_model/mpt/flash_attn_triton.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """ Copied from https://github.com/HazyResearch/flash-attention/blob/eff9fe6b8076df59d64d7a3f464696738a3c7c24/flash_attn/flash_attn_triton.py update imports to use 'triton_pre_mlir' diff --git a/llava/model/language_model/mpt/hf_prefixlm_converter.py b/llava/model/language_model/mpt/hf_prefixlm_converter.py index 62378a78..bcf65699 100755 --- a/llava/model/language_model/mpt/hf_prefixlm_converter.py +++ b/llava/model/language_model/mpt/hf_prefixlm_converter.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """Converts Huggingface Causal LM to Prefix LM. Conversion does lightweight surgery on a HuggingFace diff --git a/llava/model/language_model/mpt/meta_init_context.py b/llava/model/language_model/mpt/meta_init_context.py index 681cac18..f7f64813 100755 --- a/llava/model/language_model/mpt/meta_init_context.py +++ b/llava/model/language_model/mpt/meta_init_context.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from contextlib import contextmanager import torch diff --git a/llava/model/language_model/mpt/modeling_mpt.py b/llava/model/language_model/mpt/modeling_mpt.py index 8d9fe04d..ade22085 100755 --- a/llava/model/language_model/mpt/modeling_mpt.py +++ b/llava/model/language_model/mpt/modeling_mpt.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + """A simple, flexible implementation of a GPT model. Inspired by https://github.com/karpathy/minGPT/blob/master/mingpt/model.py diff --git a/llava/model/language_model/mpt/norm.py b/llava/model/language_model/mpt/norm.py index f403050d..62773b17 100755 --- a/llava/model/language_model/mpt/norm.py +++ b/llava/model/language_model/mpt/norm.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch diff --git a/llava/model/language_model/mpt/param_init_fns.py b/llava/model/language_model/mpt/param_init_fns.py index c9795ea4..0fc60c70 100755 --- a/llava/model/language_model/mpt/param_init_fns.py +++ b/llava/model/language_model/mpt/param_init_fns.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import math import warnings from collections.abc import Sequence diff --git a/llava/model/make_delta.py b/llava/model/make_delta.py index 37c62568..5a18327b 100755 --- a/llava/model/make_delta.py +++ b/llava/model/make_delta.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ """ diff --git a/llava/model/multimodal_encoder/builder.py b/llava/model/multimodal_encoder/builder.py index ab676b93..ef3ae492 100755 --- a/llava/model/multimodal_encoder/builder.py +++ b/llava/model/multimodal_encoder/builder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ import os diff --git a/llava/model/multimodal_encoder/clip_encoder.py b/llava/model/multimodal_encoder/clip_encoder.py index 760587d9..a6c4c45b 100755 --- a/llava/model/multimodal_encoder/clip_encoder.py +++ b/llava/model/multimodal_encoder/clip_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ import torch from transformers import CLIPImageProcessor, CLIPVisionModel, PretrainedConfig diff --git a/llava/model/multimodal_encoder/intern/flash_attention.py b/llava/model/multimodal_encoder/intern/flash_attention.py index 4c087346..cf5b162f 100755 --- a/llava/model/multimodal_encoder/intern/flash_attention.py +++ b/llava/model/multimodal_encoder/intern/flash_attention.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # https://github.com/Dao-AILab/flash-attention/blob/v0.2.8/flash_attn/flash_attention.py import torch import torch.nn as nn diff --git a/llava/model/multimodal_encoder/intern_encoder.py b/llava/model/multimodal_encoder/intern_encoder.py index 8fd0cd44..b37849c1 100755 --- a/llava/model/multimodal_encoder/intern_encoder.py +++ b/llava/model/multimodal_encoder/intern_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch import torchvision.transforms as T from torchvision.transforms.functional import InterpolationMode diff --git a/llava/model/multimodal_encoder/radio_encoder.py b/llava/model/multimodal_encoder/radio_encoder.py index 56b36afa..838eb392 100755 --- a/llava/model/multimodal_encoder/radio_encoder.py +++ b/llava/model/multimodal_encoder/radio_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import warnings from argparse import Namespace diff --git a/llava/model/multimodal_encoder/radio_torchhub_encoder.py b/llava/model/multimodal_encoder/radio_torchhub_encoder.py index 3cff7832..05c07e7f 100644 --- a/llava/model/multimodal_encoder/radio_torchhub_encoder.py +++ b/llava/model/multimodal_encoder/radio_torchhub_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import warnings from argparse import Namespace diff --git a/llava/model/multimodal_encoder/siglip_encoder.py b/llava/model/multimodal_encoder/siglip_encoder.py index 4524e8c8..b7f6cda1 100755 --- a/llava/model/multimodal_encoder/siglip_encoder.py +++ b/llava/model/multimodal_encoder/siglip_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch from transformers import PretrainedConfig, SiglipImageProcessor, SiglipVisionModel diff --git a/llava/model/multimodal_encoder/vision_encoder.py b/llava/model/multimodal_encoder/vision_encoder.py index 92c63967..384fd6a2 100755 --- a/llava/model/multimodal_encoder/vision_encoder.py +++ b/llava/model/multimodal_encoder/vision_encoder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ from abc import abstractmethod diff --git a/llava/model/multimodal_projector/base_projector.py b/llava/model/multimodal_projector/base_projector.py index b67ccecf..4cf812ba 100755 --- a/llava/model/multimodal_projector/base_projector.py +++ b/llava/model/multimodal_projector/base_projector.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import re import torch diff --git a/llava/model/multimodal_projector/builder.py b/llava/model/multimodal_projector/builder.py index 9dd70a41..4fb0c832 100755 --- a/llava/model/multimodal_projector/builder.py +++ b/llava/model/multimodal_projector/builder.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # This file is modified from https://github.com/haotian-liu/LLaVA/ import os diff --git a/llava/train/llama_dpsp_attn_monkey_patch.py b/llava/train/llama_dpsp_attn_monkey_patch.py index 17694626..7875883e 100755 --- a/llava/train/llama_dpsp_attn_monkey_patch.py +++ b/llava/train/llama_dpsp_attn_monkey_patch.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import sys import time diff --git a/llava/train/sequence_parallel/globals.py b/llava/train/sequence_parallel/globals.py index 47c16430..3daf13d1 100755 --- a/llava/train/sequence_parallel/globals.py +++ b/llava/train/sequence_parallel/globals.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import deepspeed.comm as dist diff --git a/llava/train/sequence_parallel/hybrid_attn.py b/llava/train/sequence_parallel/hybrid_attn.py index 52286a29..f6d016c0 100755 --- a/llava/train/sequence_parallel/hybrid_attn.py +++ b/llava/train/sequence_parallel/hybrid_attn.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from typing import Any import torch diff --git a/llava/train/sequence_parallel/input_utils.py b/llava/train/sequence_parallel/input_utils.py index d46a4220..5baa58b6 100755 --- a/llava/train/sequence_parallel/input_utils.py +++ b/llava/train/sequence_parallel/input_utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch diff --git a/llava/train/sequence_parallel/monkey_patch.py b/llava/train/sequence_parallel/monkey_patch.py index da2a0204..5dc59762 100755 --- a/llava/train/sequence_parallel/monkey_patch.py +++ b/llava/train/sequence_parallel/monkey_patch.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from typing import List, Optional, Tuple, Union import torch diff --git a/llava/train/sequence_parallel/ring/ring_flash_attn.py b/llava/train/sequence_parallel/ring/ring_flash_attn.py index 8ebd3c9b..16140dd7 100755 --- a/llava/train/sequence_parallel/ring/ring_flash_attn.py +++ b/llava/train/sequence_parallel/ring/ring_flash_attn.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/sequence_parallel/ring/ring_flash_attn_varlen.py b/llava/train/sequence_parallel/ring/ring_flash_attn_varlen.py index 96d1897d..2e5cfee0 100755 --- a/llava/train/sequence_parallel/ring/ring_flash_attn_varlen.py +++ b/llava/train/sequence_parallel/ring/ring_flash_attn_varlen.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/sequence_parallel/ring/stripe_flash_attn.py b/llava/train/sequence_parallel/ring/stripe_flash_attn.py index 50008184..6e0e8f27 100755 --- a/llava/train/sequence_parallel/ring/stripe_flash_attn.py +++ b/llava/train/sequence_parallel/ring/stripe_flash_attn.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Striped Attention Paper: https://arxiv.org/abs/2311.09431 diff --git a/llava/train/sequence_parallel/ring/triton_utils.py b/llava/train/sequence_parallel/ring/triton_utils.py index e64c12ce..ca3aaad0 100755 --- a/llava/train/sequence_parallel/ring/triton_utils.py +++ b/llava/train/sequence_parallel/ring/triton_utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/sequence_parallel/ring/utils.py b/llava/train/sequence_parallel/ring/utils.py index e02babad..867bf920 100755 --- a/llava/train/sequence_parallel/ring/utils.py +++ b/llava/train/sequence_parallel/ring/utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn.py b/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn.py index 436fb942..d3451313 100755 --- a/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn.py +++ b/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn_varlen.py b/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn_varlen.py index d4c55be6..ed5c7000 100755 --- a/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn_varlen.py +++ b/llava/train/sequence_parallel/ring/zigzag_ring_flash_attn_varlen.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # Adopted from https://github.com/zhuzilin/ring-flash-attention. # Implementation refers to Ring Attention Paper: https://arxiv.org/abs/2310.01889 diff --git a/llava/train/short_video_filter.py b/llava/train/short_video_filter.py index a65d9231..f28fda7c 100755 --- a/llava/train/short_video_filter.py +++ b/llava/train/short_video_filter.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import json import os diff --git a/llava/train/slurm_utils.py b/llava/train/slurm_utils.py index 30366a4d..1cfca3a7 100755 --- a/llava/train/slurm_utils.py +++ b/llava/train/slurm_utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import datetime import logging import logging.handlers diff --git a/llava/train/utils.py b/llava/train/utils.py index 9ef104f3..acaf49be 100755 --- a/llava/train/utils.py +++ b/llava/train/utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import copy import os import pathlib diff --git a/llava/trl/extras/best_of_n_sampler.py b/llava/trl/extras/best_of_n_sampler.py index b400b14b..80810433 100644 --- a/llava/trl/extras/best_of_n_sampler.py +++ b/llava/trl/extras/best_of_n_sampler.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from typing import Any, Callable, List, Optional, Union import torch diff --git a/llava/trl/extras/dataset_formatting.py b/llava/trl/extras/dataset_formatting.py index af2c777c..7583ce21 100644 --- a/llava/trl/extras/dataset_formatting.py +++ b/llava/trl/extras/dataset_formatting.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import logging from typing import Callable, Literal, Optional, Union diff --git a/llava/trl/models/utils.py b/llava/trl/models/utils.py index 849ac190..87d7ef39 100644 --- a/llava/trl/models/utils.py +++ b/llava/trl/models/utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from dataclasses import dataclass from typing import Literal, Optional, Tuple diff --git a/llava/trl/trainer/ddpo_config.py b/llava/trl/trainer/ddpo_config.py index b73bd58d..6d692287 100644 --- a/llava/trl/trainer/ddpo_config.py +++ b/llava/trl/trainer/ddpo_config.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import sys import warnings diff --git a/llava/trl/trainer/model_config.py b/llava/trl/trainer/model_config.py index b54debb6..8ac4a9fa 100644 --- a/llava/trl/trainer/model_config.py +++ b/llava/trl/trainer/model_config.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + from dataclasses import dataclass, field from typing import List, Optional diff --git a/llava/utils/tokenizer.py b/llava/utils/tokenizer.py index 4215df3f..dabab058 100644 --- a/llava/utils/tokenizer.py +++ b/llava/utils/tokenizer.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import logging from typing import Any, Dict, List, Optional, Sequence diff --git a/scripts/v1_5/eval/compute_accuracy.py b/scripts/v1_5/eval/compute_accuracy.py index f22d69cc..c2c97bf2 100644 --- a/scripts/v1_5/eval/compute_accuracy.py +++ b/scripts/v1_5/eval/compute_accuracy.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import argparse import json import os diff --git a/scripts/v1_5/eval/convert_pred_to_csv.py b/scripts/v1_5/eval/convert_pred_to_csv.py index d2feab34..cef5a6c4 100644 --- a/scripts/v1_5/eval/convert_pred_to_csv.py +++ b/scripts/v1_5/eval/convert_pred_to_csv.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import argparse import csv import json diff --git a/tests/python/_test_dataset.py b/tests/python/_test_dataset.py index c4412c41..87774988 100644 --- a/tests/python/_test_dataset.py +++ b/tests/python/_test_dataset.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os.path as osp import unittest diff --git a/tests/python/test_llava_arch.py b/tests/python/test_llava_arch.py index 5d8e21e2..15abc702 100644 --- a/tests/python/test_llava_arch.py +++ b/tests/python/test_llava_arch.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # @yunhao: deprecated comment """ A inference test on llava_arch.py diff --git a/tests/python/test_loading.py b/tests/python/test_loading.py index a88779fe..f6728ec1 100644 --- a/tests/python/test_loading.py +++ b/tests/python/test_loading.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import random import shutil diff --git a/tests/python/test_packing.py b/tests/python/test_packing.py index 40f6e1b2..13d95d36 100644 --- a/tests/python/test_packing.py +++ b/tests/python/test_packing.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import copy import unittest diff --git a/tests/python/test_preprocess_multimodal.py b/tests/python/test_preprocess_multimodal.py index 41fcdcbd..5c8fffbd 100644 --- a/tests/python/test_preprocess_multimodal.py +++ b/tests/python/test_preprocess_multimodal.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import unittest import torch diff --git a/tests/python/test_projector.py b/tests/python/test_projector.py index 238680f5..7cc93261 100644 --- a/tests/python/test_projector.py +++ b/tests/python/test_projector.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import unittest import torch diff --git a/tests/python/test_rope_scaling.py b/tests/python/test_rope_scaling.py index 61c94da2..f8059a78 100644 --- a/tests/python/test_rope_scaling.py +++ b/tests/python/test_rope_scaling.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import os import sys import unittest diff --git a/tests/python/test_set_grads.py b/tests/python/test_set_grads.py index 7d66537d..23f632d7 100644 --- a/tests/python/test_set_grads.py +++ b/tests/python/test_set_grads.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import copy import unittest diff --git a/tests/python/test_sp_ulysses_attn.py b/tests/python/test_sp_ulysses_attn.py index ceb28d3f..2779b08a 100644 --- a/tests/python/test_sp_ulysses_attn.py +++ b/tests/python/test_sp_ulysses_attn.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import torch import torch.distributed as dist from flash_attn import flash_attn_func diff --git a/tests/python/test_tokenizer_utils.py b/tests/python/test_tokenizer_utils.py index cd127647..0eae2c32 100644 --- a/tests/python/test_tokenizer_utils.py +++ b/tests/python/test_tokenizer_utils.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import unittest from typing import Any, Dict, List, Tuple diff --git a/upload2hf.py b/upload2hf.py index cb725e52..9ac8f087 100644 --- a/upload2hf.py +++ b/upload2hf.py @@ -1,3 +1,19 @@ +# Copyright 2024 NVIDIA CORPORATION & AFFILIATES +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + import argparse import os import os.path as osp