repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | api_gen.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:18.577576 | """Script to generate keras_hub public API in `keras_hub/api` directory.
Usage:
Run via `./shell/api_gen.sh`.
It generates API and formats user and generated APIs.
"""
import os
import shutil
import namex
PACKAGE = "keras_hub"
BUILD_DIR_NAME = "tmp_build_dir"
def ignore_files(_, filenames):
return [f for f i... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | benchmarks/glue.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:18.578795 | """GLUE benchmark script to test model performance.
To run the script, use this command:
```
python3 glue.py --model BertTextClassifier \
--preset bert_base_en \
--epochs 5 \
--batch_size 16 \
--learning_rate 0.001 \
--mixed_precision_poli... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:18.720949 | # This file should NEVER be packaged! This is a hack to make "import keras_hub"
# from the base of the repo import the api correctly. We'll keep it for compat.
import os # isort: skip
# Add everything in /api/ to the module search path.
__path__.append(os.path.join(os.path.dirname(__file__), "api")) # noqa: F405
f... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | benchmarks/text_generation.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:18.833049 | """Benchmark for text generation."""
import time
import tensorflow as tf
from tensorflow import keras
import keras_hub
SEED = 42
DATASET_ARGS = {
"vocab_size": 40000,
"num_samples": 1000,
"batch_size": 2,
}
MODEL_ARGS = {
"max_length": 64,
"embed_dim": 768,
"num_layers": 8,
"num_heads"... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/api_export.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:20.479992 | import types
from keras.saving import register_keras_serializable
try:
import namex
except ImportError:
namex = None
def maybe_register_serializable(path, symbol):
if isinstance(path, (list, tuple)):
# If we have multiple export names, actually make sure to register these
# first. This m... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/alibi_bias.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:20.796106 | import math
import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.AlibiBias")
class AlibiBias(keras.layers.Layer):
"""A layer that adds the alibi bias to attention scores.
This layer adds the alibi bias to the attention scores. Alibi bi... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/alibi_bias_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.119170 | import keras
from keras import ops
from keras import random
from keras_hub.src.layers.modeling.alibi_bias import AlibiBias
from keras_hub.src.tests.test_case import TestCase
class AlibiBiasTest(TestCase):
def test_layer_behaviors(self):
alibi_bias_max = 8
batch_size = 4
num_heads = 8
... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/anchor_generator.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.225160 | import math
import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.utils.tensor_utils import assert_bounding_box_support
@keras_hub_export("keras_hub.layers.AnchorGenerator")
class AnchorGenerator(keras.layers.Layer):
"""Generates anchor boxes for object dete... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/anchor_generator_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.226594 | import keras
import numpy as np
import pytest
from absl.testing import parameterized
from keras import ops
from packaging import version
from keras_hub.src.layers.modeling.anchor_generator import AnchorGenerator
from keras_hub.src.tests.test_case import TestCase
@pytest.mark.skipif(
version.parse(keras.__version... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/box_matcher.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.356179 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.utils.tensor_utils import assert_bounding_box_support
@keras_hub_export("keras_hub.layers.BoxMatcher")
class BoxMatcher(keras.layers.Layer):
"""Box matching logic based on argmax of highest value (e.g., IO... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/box_matcher_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.543489 | import keras
import numpy as np
import pytest
from keras import ops
from packaging import version
from keras_hub.src.layers.modeling.box_matcher import BoxMatcher
from keras_hub.src.tests.test_case import TestCase
@pytest.mark.skipif(
version.parse(keras.__version__) < version.parse("3.8.0"),
reason="Bbox ut... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | integration_tests/import_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.572283 | import unittest
import keras_hub
class ImportTest(unittest.TestCase):
def test_version(self):
self.assertIsNotNone(keras_hub.__version__)
|
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.684687 | import os
import keras
import pytest
# OpenVINO supported test paths
OPENVINO_SUPPORTED_PATHS = [
"keras-hub/integration_tests",
"keras_hub/src/models/gemma",
"keras_hub/src/models/gpt2",
"keras_hub/src/models/mistral",
"keras_hub/src/tokenizers",
]
# OpenVINO specific test skips
OPENVINO_SPECIFI... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | integration_tests/no_tensorflow_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.703081 | import unittest
import numpy as np
import keras_hub
class NoTensorflow(unittest.TestCase):
def test_backbone_works(self):
backbone = keras_hub.models.BertBackbone.from_preset(
"bert_tiny_en_uncased",
)
backbone.predict(
{
"token_ids": np.ones((4, 1... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/cached_multi_head_attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.788825 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.CachedMultiHeadAttention")
class CachedMultiHeadAttention(keras.layers.MultiHeadAttention):
"""MultiHeadAttention layer with cache support.
This layer is suitable for use in autoregre... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/f_net_encoder.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.791106 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.utils.keras_utils import clone_initializer
@keras_hub_export("keras_hub.layers.FNetEncoder")
class FNetEncoder(keras.layers.Layer):
"""FNet encoder.
This class follows the architecture of FNet encoder... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | integration_tests/basic_usage_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.814950 | import unittest
import keras
import numpy as np
import keras_hub
class BasicUsageTest(unittest.TestCase):
def test_transformer(self):
# Tokenize some inputs with a binary label.
vocab = ["[UNK]", "the", "qu", "##ick", "br", "##own", "fox", "."]
sentences = ["The quick brown fox jumped.",... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/cached_multi_head_attention_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.966632 | from keras import ops
from keras import random
from keras_hub.src.layers.modeling.cached_multi_head_attention import (
CachedMultiHeadAttention,
)
from keras_hub.src.tests.test_case import TestCase
class CachedMultiHeadAttentionTest(TestCase):
def test_layer_behaviors(self):
self.run_layer_test(
... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/f_net_encoder_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:21.974274 | from keras import ops
from keras import random
from keras_hub.src.layers.modeling.f_net_encoder import FNetEncoder
from keras_hub.src.tests.test_case import TestCase
class FNetEncoderTest(TestCase):
def test_layer_behaviors(self):
self.run_layer_test(
cls=FNetEncoder,
init_kwargs=... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/masked_lm_head.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.109837 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.MaskedLMHead")
class MaskedLMHead(keras.layers.Layer):
"""Masked Language Model (MaskedLM) head.
This layer takes two inputs:
- `inputs`: which should be a tensor of encoded tok... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/masked_lm_head_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.179252 | from keras import random
from keras_hub.src.layers.modeling.masked_lm_head import MaskedLMHead
from keras_hub.src.layers.modeling.reversible_embedding import (
ReversibleEmbedding,
)
from keras_hub.src.tests.test_case import TestCase
class MaskedLMHeadTest(TestCase):
def test_layer_behaviors(self):
s... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/non_max_supression.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.206328 | import math
import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.utils.tensor_utils import assert_bounding_box_support
EPSILON = 1e-8
@keras_hub_export("keras_hub.layers.NonMaxSuppression")
class NonMaxSuppression(keras.layers.Layer):
"""A Keras layer that... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/non_max_supression_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.409177 | import keras
import numpy as np
import pytest
from keras import ops
from packaging import version
from keras_hub.src.layers.modeling.non_max_supression import NonMaxSuppression
from keras_hub.src.tests.test_case import TestCase
class NonMaxSupressionTest(TestCase):
@pytest.mark.skipif(
version.parse(kera... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/position_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.438520 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.PositionEmbedding")
class PositionEmbedding(keras.layers.Layer):
"""A layer which learns a position embedding for inputs sequences.
This class assumes that in the input tensor, the la... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/position_embedding_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.473826 | import keras
import numpy as np
from keras import ops
from keras import random
from keras_hub.src.layers.modeling.position_embedding import PositionEmbedding
from keras_hub.src.tests.test_case import TestCase
def custom_init(shape, dtype=None):
count = 1
for length in shape:
count *= length
retur... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/reversible_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.491253 | import keras
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.ReversibleEmbedding")
class ReversibleEmbedding(keras.layers.ReversibleEmbedding):
pass
|
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/rms_normalization.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.521070 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.RMSNormalization")
class RMSNormalization(keras.layers.Layer):
"""Root Mean Square (RMS) Normalization layer.
This layer normalizes the input tensor based on its RMS value and applies... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/rotary_embedding_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.540230 | import keras
import numpy as np
from keras import ops
from keras import random
from keras_hub.src.layers.modeling.rotary_embedding import RotaryEmbedding
from keras_hub.src.tests.test_case import TestCase
class RotaryEmbeddingTest(TestCase):
def test_layer_behaviors(self):
self.run_layer_test(
... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/rotary_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.554067 | import keras
import numpy as np
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.RotaryEmbedding")
class RotaryEmbedding(keras.layers.Layer):
"""Rotary positional encoding layer.
This layer encodes absolute positional information with a rotation... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/sine_position_encoding.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.747050 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
@keras_hub_export("keras_hub.layers.SinePositionEncoding")
class SinePositionEncoding(keras.layers.Layer):
"""Sinusoidal positional encoding layer.
This layer calculates the position encoding as a mix of sine and cosine... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/sine_position_encoding_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.783639 | import keras
from keras import ops
from keras import random
from keras_hub.src.layers.modeling.sine_position_encoding import (
SinePositionEncoding,
)
from keras_hub.src.tests.test_case import TestCase
class SinePositionEncodingTest(TestCase):
def test_layer_behaviors(self):
self.run_layer_test(
... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/token_and_position_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:22.808395 | import keras
from keras.layers import ReversibleEmbedding
from keras.src.backend import get_keras_mask
from keras.src.backend import set_keras_mask
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.layers.modeling.position_embedding import PositionEmbedding
from keras_hub.src.utils.keras_utils i... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/transformer_decoder_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:23.103036 | from absl.testing import parameterized
from keras import ops
from keras import random
from keras.src.backend import get_keras_mask
from keras.src.backend import set_keras_mask
from keras_hub.src.layers.modeling.transformer_decoder import TransformerDecoder
from keras_hub.src.tests.test_case import TestCase
class Tra... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/token_and_position_embedding_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:23.148712 | import numpy as np
from keras import ops
from keras import random
from keras.src.backend import get_keras_mask
from keras_hub.src.layers.modeling.token_and_position_embedding import (
TokenAndPositionEmbedding,
)
from keras_hub.src.tests.test_case import TestCase
class TokenAndPositionEmbeddingTest(TestCase):
... |
keras-team/keras-hub | https://github.com/keras-team/keras-hub | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | keras_hub/src/layers/modeling/transformer_decoder.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:23.179742 | import keras
from keras import ops
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.layers.modeling.cached_multi_head_attention import (
CachedMultiHeadAttention,
)
from keras_hub.src.layers.modeling.transformer_layer_utils import (
compute_causal_mask,
)
from keras_hub.src.layers.model... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/pipelines/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.529844 | from .i2v_pipeline import I2VPipeline
from .pipeline_animation import AnimationPipeline
from .validation_pipeline import ValidationPipeline
__all__ = ["I2VPipeline", "AnimationPipeline", "ValidationPipeline"]
|
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/data/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.530454 | import csv
import io
import os
import random
import cv2
import numpy as np
import torch
import torchvision.transforms as transforms
from decord import VideoReader
from torch.utils.data.dataset import Dataset
import animatediff.data.video_transformer as video_transforms
from animatediff.utils.util import detect_edges,... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/models/unet_blocks.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.534682 | # Adapted from https://github.com/guoyww/AnimateDiff
import torch
from torch import nn
from .attention import Transformer3DModel
from .motion_module import get_motion_module
from .resnet import Downsample3D, ResnetBlock3D, Upsample3D
def get_down_block(
down_block_type,
num_layers,
in_channels,
out... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/models/unet.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.537842 | # Adapted from https://github.com/guoyww/AnimateDiff
import json
import os
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.utils.checkpoint
try:
from diffusers.models.cross_attention import AttnProcessor
except ImportError:
fr... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/models/motion_module.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.541644 | # Adapted from https://github.com/guoyww/AnimateDiff
import math
from dataclasses import dataclass
from typing import Optional
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch import nn
from diffusers.models.attention import FeedForward
from diffusers.utils import BaseOutpu... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/data/video_transformer.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.543735 | import numbers
import random
import torch
def _is_tensor_video_clip(clip):
if not torch.is_tensor(clip):
raise TypeError("clip should be Tensor. Got %s" % type(clip))
if not clip.ndimension() == 4:
raise ValueError("clip should be 4D. Got %dD" % clip.dim())
return True
def crop(clip, ... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/models/attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.548115 | # Adapted from https://github.com/guoyww/AnimateDiff
from dataclasses import dataclass
from typing import Optional
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch import nn
from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.models imp... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/models/resnet.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.577366 | # Adapted from https://github.com/guoyww/AnimateDiff
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
class InflatedConv3d(nn.Conv2d):
def forward(self, x):
video_length = x.shape[2]
x = rearrange(x, "b c f h w -> (b f) c h w")
x = super().f... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/pipelines/i2v_pipeline.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:25.689333 | # Adapted from https://github.com/showlab/Tune-A-Video/blob/main/tuneavideo/pipelines/pipeline_tuneavideo.py
import inspect
import os.path as osp
from dataclasses import dataclass
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from einops import rearrange
from omegaconf import Omega... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/utils/convert_from_ckpt.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.292444 | # Copyright 2023 The HuggingFace Inc. team.
#
# 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 ... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | inference.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.372975 | # Adapted from https://github.com/showlab/Tune-A-Video/blob/main/tuneavideo/pipelines/pipeline_tuneavideo.py
import argparse
import os
import numpy as np
import torch
from omegaconf import OmegaConf
from animatediff.pipelines import I2VPipeline
from animatediff.utils.util import preprocess_img, save_videos_grid
def... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/pipelines/pipeline_animation.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.373947 | # Adapted from https://github.com/showlab/Tune-A-Video/blob/main/tuneavideo/pipelines/pipeline_tuneavideo.py
import inspect
from dataclasses import dataclass
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from einops import rearrange
from packaging import version
from tqdm import t... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/utils/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.404239 | import math
import os
from typing import Optional, Union
import cv2
import imageio
import moviepy.editor as mpy
import numpy as np
import torch
import torch.distributed as dist
import torchvision
from einops import rearrange
from PIL import Image
from tqdm import tqdm
# We recommend to use the following affinity sco... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.410783 | import json
import os
import os.path as osp
import random
from argparse import ArgumentParser
from datetime import datetime
from glob import glob
import gradio as gr
import numpy as np
import torch
from omegaconf import OmegaConf
from PIL import Image
from animatediff.pipelines import I2VPipeline
from animatediff.uti... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | train.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:26.753473 | # largely borrowed from https://github.com/guoyww/AnimateDiff/blob/main/train.py
import argparse
import datetime
import inspect
import logging
import math
import os
import random
import subprocess
from pathlib import Path
from typing import Dict, Tuple
import torch
import torch.distributed as dist
import torch.nn.func... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | predict.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:27.064897 | # Prediction interface for Cog ⚙️
# https://github.com/replicate/cog/blob/main/docs/python.md
import os.path as osp
import numpy as np
import torch
from cog import BasePredictor, Input, Path
from omegaconf import OmegaConf
from PIL import Image
from animatediff.pipelines import I2VPipeline
from animatediff.utils.uti... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/utils/convert_lora_safetensor_to_diffusers.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:27.344428 | # Copyright 2023, Haofan Wang, Qixun Wang, All rights reserved.
#
# 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 appli... |
open-mmlab/PIA | https://github.com/open-mmlab/PIA | null | null | null | null | 975 | null | null | apache-2.0 | null | null | null | null | null | null | null | animatediff/pipelines/validation_pipeline.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:27.363185 | # Adapted from https://github.com/showlab/Tune-A-Video/blob/main/tuneavideo/pipelines/pipeline_tuneavideo.py
import inspect
from dataclasses import dataclass
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from einops import rearrange
from packaging import version
from PIL import Ima... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/human_matting/stylematte.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.720790 | import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import Mask2FormerForUniversalSegmentation
from transformers.models.mask2former.configuration_mask2former import Mask2FormerConfig
class StyleMatte(nn.Module):
def __init__(self):
super(StyleMatte, self).__init__()
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/human_matting/matting_engine.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.734153 | import os
import torch
import inspect
import warnings
import torchvision
from .stylematte import StyleMatte
class StyleMatteEngine(torch.nn.Module):
def __init__(self, device='cpu',human_matting_path='./model_zoo/flame_tracking_models/matting/stylematte_synth.pt'):
super().__init__()
self._device =... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/box_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.737449 | import torch
import numpy as np
def point_form(boxes):
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbox layers.
Return:
boxes: (tensor) Converted xmin, ymin, ... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | app_lam.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.739326 | # Copyright (c) 2024-2025, The Alibaba 3DAIGC Team Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/detector.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.746976 | import cv2
class Detector(object):
def __init__(self, model_arch, model_weights):
self.model_arch = model_arch
self.model_weights = model_weights
def detect(self, image, thresh):
raise NotImplementedError
def crop(self, image, detections):
crops = []
for det in det... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/faceboxes_detector.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.750302 | from .detector import Detector
import cv2, os
import numpy as np
import torch
import torch.nn as nn
from .utils.config import cfg
from .utils.prior_box import PriorBox
from .utils.nms_wrapper import nms
from .utils.faceboxes import FaceBoxesV2
from .utils.box_utils import decode
import time
class FaceBoxesDetector(Det... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | app_hf_space.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:29.784311 | # Copyright (c) 2024-2025, The Alibaba 3DAIGC Team Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:30.932595 | # config.py
cfg = {
'name': 'FaceBoxes',
#'min_dim': 1024,
#'feature_maps': [[32, 32], [16, 16], [8, 8]],
# 'aspect_ratios': [[1], [1], [1]],
'min_sizes': [[32, 64, 128], [256], [512]],
'steps': [32, 64, 128],
'variance': [0.1, 0.2],
'clip': False,
'loc_weight': 2.0,
'gpu_train'... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/faceboxes.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:30.935412 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
self.bn = nn.BatchNorm2d(out... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/prior_box.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:30.936838 | import torch
from itertools import product as product
import numpy as np
from math import ceil
class PriorBox(object):
def __init__(self, cfg, image_size=None, phase='train'):
super(PriorBox, self).__init__()
#self.aspect_ratios = cfg['aspect_ratios']
self.min_sizes = cfg['min_sizes']
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/nms_wrapper.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:30.938118 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from .nms.cpu_nms import cpu_nms, cpu_soft_nms
def nms(dets, thresh):
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/timer.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:30.948523 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import time
class Timer(object):
"""A simple timer."""
def __... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/build.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:31.752277 | # coding: utf-8
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
import num... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/conf/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.486699 | import uuid
import logging
import os.path as osp
from argparse import Namespace
# from tensorboardX import SummaryWriter
class Base:
"""
Base configure file, which contains the basic training parameters and should be inherited by other attribute configure file.
"""
def __init__(self, config... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/evaluate.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.488780 | import os
import cv2
import math
import argparse
import numpy as np
from tqdm import tqdm
import torch
# private package
from lib import utility
class GetCropMatrix():
"""
from_shape -> transform_matrix
"""
def __init__(self, image_size, target_face_scale, align_corners=False):
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/data_processor/process_pcd.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.490631 | import os
import cv2
import numpy as np
import open3d as o3d
# import pyrender
# from pyrender import mesh, DirectionalLight, Material, PerspectiveCamera
os.environ['__GL_THREADED_OPTIMIZATIONS'] = '1'
cord_list = []
with open('./cord.txt', 'r') as f:
lines = f.readlines()
for line in lines:
m = line.... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/data_processor/align.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.491827 | import numpy as np
import open3d as o3d
from scipy.spatial.transform import Rotation
from scipy.linalg import orthogonal_procrustes
from open3d.pipelines.registration import registration_ransac_based_on_correspondence
def rigid_transform_3D(A, B):
assert A.shape == B.shape, "Input arrays must have the same shape... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/conf/alignment.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.492703 | import os.path as osp
from .base import Base
class Alignment(Base):
"""
Alignment configure file, which contains training parameters of alignment.
"""
def __init__(self, args):
super(Alignment, self).__init__('alignment')
self.ckpt_dir = '/mnt/workspace/humanAIGC/project/ST... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/data_processor/CheckFaceKeyPoint.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.520327 | import os
import cv2
import numpy as np
from PIL import Image
selected_indices_old = [
2311,
2416,
2437,
2460,
2495,
2518,
2520,
2627,
4285,
4315,
6223,
6457,
6597,
6642,
6974,
7054,
7064,
7182,
7303,
7334,
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/FaceBoxesV2/utils/nms/py_cpu_nms.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.639497 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def py_cpu_nms(dets, thresh):
"""Pure Python NM... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/infer_folder.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:32.814580 | import cv2
import math
import copy
import numpy as np
import argparse
import torch
import json
# private package
from lib import utility
from FaceBoxesV2.faceboxes_detector import *
class GetCropMatrix():
"""
from_shape -> transform_matrix
"""
def __init__(self, image_size, target_face_scale, align_c... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/infer_video.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.227980 | import cv2
import math
import copy
import numpy as np
import argparse
import torch
import json
# private package
from lib import utility
from FaceBoxesV2.faceboxes_detector import *
class GetCropMatrix():
"""
from_shape -> transform_matrix
"""
def __init__(self, image_size, target_face_scale, align_c... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.394555 | from .encoder import get_encoder
from .decoder import get_decoder
from .augmentation import Augmentation
from .alignmentDataset import AlignmentDataset
__all__ = [
"Augmentation",
"AlignmentDataset",
"get_encoder",
"get_decoder"
]
|
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/backbone/core/coord_conv.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.396287 | import torch
import torch.nn as nn
class AddCoordsTh(nn.Module):
def __init__(self, x_dim, y_dim, with_r=False, with_boundary=False):
super(AddCoordsTh, self).__init__()
self.x_dim = x_dim
self.y_dim = y_dim
self.with_r = with_r
self.with_boundary = with_boundary
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/backbone/stackedHGNetV1.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.403787 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .core.coord_conv import CoordConvTh
from external.landmark_detection.lib.dataset import get_decoder
class Activation(nn.Module):
def __init__(self, kind: str = 'relu', channel=None):
super().__init__... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.434143 | from .dataset import get_encoder, get_decoder
from .dataset import AlignmentDataset, Augmentation
from .backbone import StackedHGNetV1
from .metric import NME, Accuracy
from .utils import time_print, time_string, time_for_file, time_string_short
from .utils import convert_secs2time, convert_size2str
from .utili... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/alignmentDataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:33.499666 | import os
import sys
import cv2
import math
import copy
import hashlib
import imageio
import numpy as np
import pandas as pd
from scipy import interpolate
from PIL import Image, ImageEnhance, ImageFile
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
ImageFile.LOAD_TRU... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/augmentation.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:34.534330 | import os
import cv2
import math
import random
import numpy as np
from skimage import transform
class Augmentation:
def __init__(self,
is_train=True,
aug_prob=1.0,
image_size=256,
crop_op=True,
std_lmk_5pts=None,
... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/decoder/decoder_default.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:34.700932 | import torch
class decoder_default:
def __init__(self, weight=1, use_weight_map=False):
self.weight = weight
self.use_weight_map = use_weight_map
def _make_grid(self, h, w):
yy, xx = torch.meshgrid(
torch.arange(h).float() / (h - 1) * 2 - 1,
torch.ar... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/starLoss_v2.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:35.282902 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from .smoothL1Loss import SmoothL1Loss
from .wingLoss import WingLoss
def get_channel_sum(input):
temp = torch.sum(input, dim=3)
output = torch.sum(temp, dim=2)
return output
def expand... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/wingLoss.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:35.452948 | # -*- coding: utf-8 -*-
import math
import torch
from torch import nn
# torch.log and math.log is e based
class WingLoss(nn.Module):
def __init__(self, omega=0.01, epsilon=2):
super(WingLoss, self).__init__()
self.omega = omega
self.epsilon = epsilon
def forward(self, ... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/metric/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:36.026445 | from .nme import NME
from .accuracy import Accuracy
from .fr_and_auc import FR_AUC
from .params import count_parameters_in_MB
__all__ = [
"NME",
"Accuracy",
"FR_AUC",
'count_parameters_in_MB',
]
|
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/metric/accuracy.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:36.156354 | import torch
import torch.nn.functional as F
class Accuracy:
def __init__(self):
pass
def __repr__(self):
return "Accuracy()"
def test(self, label_pd, label_gt, ignore_label=-1):
correct_cnt = 0
total_cnt = 0
with torch.no_grad():
label_pd... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/metric/fr_and_auc.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:36.694928 | import numpy as np
from scipy.integrate import simps
class FR_AUC:
def __init__(self, data_definition):
self.data_definition = data_definition
if data_definition == '300W':
self.thresh = 0.05
else:
self.thresh = 0.1
def __repr__(self):
retu... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/metric/nme.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:36.786859 | import torch
import numpy as np
class NME:
def __init__(self, nme_left_index, nme_right_index):
self.nme_left_index = nme_left_index
self.nme_right_index = nme_right_index
def __repr__(self):
return "NME()"
def get_norm_distance(self, landmarks):
assert isinsta... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/encoder/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:38.978059 | from .encoder_default import encoder_default
def get_encoder(image_height, image_width, scale=0.25, sigma=1.5, encoder_type='default'):
if encoder_type == 'default':
encoder = encoder_default(image_height, image_width, scale, sigma)
else:
raise NotImplementedError
return encoder
|
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/encoder/encoder_default.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:38.984135 | import copy
import numpy as np
import torch
import torch.nn.functional as F
class encoder_default:
def __init__(self, image_height, image_width, scale=0.25, sigma=1.5):
self.image_height = image_height
self.image_width = image_width
self.scale = scale
self.sigma = sigm... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/awingLoss.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:38.991868 | import torch
import torch.nn as nn
import torch.nn.functional as F
class AWingLoss(nn.Module):
def __init__(self, omega=14, theta=0.5, epsilon=1, alpha=2.1, use_weight_map=True):
super(AWingLoss, self).__init__()
self.omega = omega
self.theta = theta
self.epsilon = epsilo... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:38.999790 | from .awingLoss import AWingLoss
from .smoothL1Loss import SmoothL1Loss
from .wingLoss import WingLoss
from .starLoss import STARLoss
from .starLoss_v2 import STARLoss_v2
__all__ = [
"AWingLoss",
"SmoothL1Loss",
"WingLoss",
"STARLoss",
"STARLoss_v2",
]
|
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/dataset/decoder/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:39.118022 | from .decoder_default import decoder_default
def get_decoder(decoder_type='default'):
if decoder_type == 'default':
decoder = decoder_default()
else:
raise NotImplementedError
return decoder |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/smoothL1Loss.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:39.119262 | import torch
import torch.nn as nn
class SmoothL1Loss(nn.Module):
def __init__(self, scale=0.01):
super(SmoothL1Loss, self).__init__()
self.scale = scale
self.EPSILON = 1e-10
def __repr__(self):
return "SmoothL1Loss()"
def forward(self, output: torch.Tensor, ... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/lib/loss/starLoss.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:39.224388 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from .smoothL1Loss import SmoothL1Loss
from .wingLoss import WingLoss
def get_channel_sum(input):
temp = torch.sum(input, dim=3)
output = torch.sum(temp, dim=2)
return output
def expand... |
aigc3d/LAM | https://github.com/aigc3d/LAM | null | null | null | null | 974 | null | null | apache-2.0 | null | null | null | null | null | null | null | external/landmark_detection/infer_image.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:42.488597 | import cv2
import math
import copy
import numpy as np
import argparse
import torch
# private package
from external.landmark_detection.lib import utility
from external.landmark_detection.FaceBoxesV2.faceboxes_detector import *
class GetCropMatrix():
"""
from_shape -> transform_matrix
"""
def __init__(... |
OpenMOSS/MOVA | https://github.com/OpenMOSS/MOVA | null | null | null | null | 972 | null | null | apache-2.0 | null | null | null | null | null | null | null | configs/training/mova_train_low_resource.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:44.811177 | # ============================================================
# MOVA LoRA Training Configuration with FP8 CPU Offload
#
# This config enables ultra-memory-efficient training using:
# 1. FP8 quantization of frozen weights stored on CPU
# 2. weight loading/offloading during forward/backward
# 3. LoRA for parameter-effi... |
OpenMOSS/MOVA | https://github.com/OpenMOSS/MOVA | null | null | null | null | 972 | null | null | apache-2.0 | null | null | null | null | null | null | null | mova/datasets/transforms/custom.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:44.814538 | import numpy as np
from PIL import Image
def crop_and_resize(image, height, width):
image = np.array(image)
image_height, image_width, _ = image.shape
if image_height / image_width < height / width:
croped_width = int(image_height / height * width)
left = (image_width - croped_width) // 2
... |
OpenMOSS/MOVA | https://github.com/OpenMOSS/MOVA | null | null | null | null | 972 | null | null | apache-2.0 | null | null | null | null | null | null | null | configs/training/mova_train_accelerate_8gpu.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:44.817817 | # ============================================================
# MOVA LoRA Training Configuration
# ============================================================
# --------------------------------------------------
# Model Configuration
# --------------------------------------------------
diffusion_pipeline = dict(
... |
OpenMOSS/MOVA | https://github.com/OpenMOSS/MOVA | null | null | null | null | 972 | null | null | apache-2.0 | null | null | null | null | null | null | null | mova/datasets/transforms/compose.py | null | null | null | null | null | null | Python | 2026-05-04T02:35:44.825286 | from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
from mova.registry import TRANSFORMS
class Compose:
"""Compose multiple transforms sequentially.
Args:
transforms (Sequence[dict, callable], optional): Sequence of transform
object or config dict to be compo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.