Nvidia copyright
#1
by gheinrich - opened
- chat_utils.py +10 -0
- configuration_ministral_dlm.py +10 -0
- configuration_nemotron_labs_diffusion_image.py +11 -1
- demo_inference_release.py +11 -1
- emu3_vqvae/configuration_emu3p5visionvq.py +10 -0
- emu3_vqvae/modeling_emu3p5visionvq.py +10 -0
- modeling_ministral.py +11 -1
- modeling_ministral_dlm.py +10 -0
- modeling_nemotron_labs_diffusion_image.py +11 -1
- nemotron_diffusion_image_utils.py +11 -1
chat_utils.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import torch
|
| 3 |
import torch.nn.functional as F
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
import numpy as np
|
| 12 |
import torch
|
| 13 |
import torch.nn.functional as F
|
configuration_ministral_dlm.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# coding=utf-8
|
| 2 |
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
#
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
# coding=utf-8
|
| 12 |
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
| 13 |
#
|
configuration_nemotron_labs_diffusion_image.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from .configuration_ministral_dlm import MinistralDLMConfig
|
| 2 |
|
| 3 |
|
|
@@ -30,4 +40,4 @@ class NemotronLabsDiffusionImageConfig(MinistralDLMConfig):
|
|
| 30 |
)
|
| 31 |
|
| 32 |
if getattr(self, "rope_parameters", None) is None and getattr(self, "rope_scaling", None) is not None:
|
| 33 |
-
self.rope_parameters = dict(self.rope_scaling)
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
from .configuration_ministral_dlm import MinistralDLMConfig
|
| 12 |
|
| 13 |
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
if getattr(self, "rope_parameters", None) is None and getattr(self, "rope_scaling", None) is not None:
|
| 43 |
+
self.rope_parameters = dict(self.rope_scaling)
|
demo_inference_release.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import argparse
|
| 2 |
import os
|
| 3 |
from pathlib import Path
|
|
@@ -246,4 +256,4 @@ def main() -> None:
|
|
| 246 |
|
| 247 |
|
| 248 |
if __name__ == "__main__":
|
| 249 |
-
main()
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
import argparse
|
| 12 |
import os
|
| 13 |
from pathlib import Path
|
|
|
|
| 256 |
|
| 257 |
|
| 258 |
if __name__ == "__main__":
|
| 259 |
+
main()
|
emu3_vqvae/configuration_emu3p5visionvq.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# coding=utf-8
|
| 2 |
# Copyright 2025 The Emu team, BAAI and The HuggingFace Inc. team. All rights reserved.
|
| 3 |
#
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
# coding=utf-8
|
| 12 |
# Copyright 2025 The Emu team, BAAI and The HuggingFace Inc. team. All rights reserved.
|
| 13 |
#
|
emu3_vqvae/modeling_emu3p5visionvq.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# coding=utf-8
|
| 2 |
# Copyright 2025 The Emu team, BAAI and The HuggingFace Inc. team. All rights reserved.
|
| 3 |
#
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
# coding=utf-8
|
| 12 |
# Copyright 2025 The Emu team, BAAI and The HuggingFace Inc. team. All rights reserved.
|
| 13 |
#
|
modeling_ministral.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from collections.abc import Callable
|
| 2 |
from typing import Optional, Union
|
| 3 |
|
|
@@ -655,4 +665,4 @@ __all__ = [
|
|
| 655 |
"Ministral3PreTrainedModel",
|
| 656 |
"Ministral3ForSequenceClassification",
|
| 657 |
"Ministral3ForTokenClassification",
|
| 658 |
-
]
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
from collections.abc import Callable
|
| 12 |
from typing import Optional, Union
|
| 13 |
|
|
|
|
| 665 |
"Ministral3PreTrainedModel",
|
| 666 |
"Ministral3ForSequenceClassification",
|
| 667 |
"Ministral3ForTokenClassification",
|
| 668 |
+
]
|
modeling_ministral_dlm.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import copy
|
| 2 |
from dataclasses import dataclass
|
| 3 |
from typing import Callable, Optional, Tuple, Union
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
import copy
|
| 12 |
from dataclasses import dataclass
|
| 13 |
from typing import Callable, Optional, Tuple, Union
|
modeling_nemotron_labs_diffusion_image.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import copy
|
| 2 |
import math
|
| 3 |
import random
|
|
@@ -848,4 +858,4 @@ class NemotronLabsDiffusionImageForMaskedDiffusion(MinistralDiffEncoderModel):
|
|
| 848 |
|
| 849 |
AutoConfig.register("nemotron_labs_diffusion_image", NemotronLabsDiffusionImageConfig)
|
| 850 |
AutoModel.register(NemotronLabsDiffusionImageConfig, NemotronLabsDiffusionImageForMaskedDiffusion)
|
| 851 |
-
AutoModelForCausalLM.register(NemotronLabsDiffusionImageConfig, NemotronLabsDiffusionImageForMaskedDiffusion)
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
import copy
|
| 12 |
import math
|
| 13 |
import random
|
|
|
|
| 858 |
|
| 859 |
AutoConfig.register("nemotron_labs_diffusion_image", NemotronLabsDiffusionImageConfig)
|
| 860 |
AutoModel.register(NemotronLabsDiffusionImageConfig, NemotronLabsDiffusionImageForMaskedDiffusion)
|
| 861 |
+
AutoModelForCausalLM.register(NemotronLabsDiffusionImageConfig, NemotronLabsDiffusionImageForMaskedDiffusion)
|
nemotron_diffusion_image_utils.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
|
| 3 |
|
|
@@ -13,4 +23,4 @@ def maybe_truncate_last_dim(tensor, size):
|
|
| 13 |
if size >= tensor.shape[-1]:
|
| 14 |
return tensor
|
| 15 |
return tensor[..., :size]
|
| 16 |
-
return tensor[..., :size]
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
| 3 |
+
#
|
| 4 |
+
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
| 5 |
+
# property and proprietary rights in and to this material, related
|
| 6 |
+
# documentation and any modifications thereto. Any use, reproduction,
|
| 7 |
+
# disclosure or distribution of this material and related documentation
|
| 8 |
+
# without an express license agreement from NVIDIA CORPORATION or
|
| 9 |
+
# its affiliates is strictly prohibited.
|
| 10 |
+
|
| 11 |
import torch
|
| 12 |
|
| 13 |
|
|
|
|
| 23 |
if size >= tensor.shape[-1]:
|
| 24 |
return tensor
|
| 25 |
return tensor[..., :size]
|
| 26 |
+
return tensor[..., :size]
|