repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/distributed_fairseq_model.py | translation/fairseq/models/distributed_fairseq_model.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from torch.nn import parallel
fro... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fconv.py | translation/fairseq/models/fconv.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch
import to... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fconv_self_att.py | translation/fairseq/models/fconv_self_att.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
#
import math
import torch
import... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fairseq_encoder.py | translation/fairseq/models/fairseq_encoder.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.nn as nn
class Fair... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fairseq_incremental_decoder.py | translation/fairseq/models/fairseq_incremental_decoder.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from . import FairseqDecoder
cla... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/lstm.py | translation/fairseq/models/lstm.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn as nn... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/__init__.py | translation/fairseq/models/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import argparse
import importlib
i... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fairseq_model.py | translation/fairseq/models/fairseq_model.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn as nn... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/composite_encoder.py | translation/fairseq/models/composite_encoder.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from . import FairseqEncoder
cla... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/transformer.py | translation/fairseq/models/transformer.py | # Modified by Zhuohan Li in May 2019 for macaron-net
#
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | true |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/models/fairseq_decoder.py | translation/fairseq/models/fairseq_decoder.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.nn as nn
import torch... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/fairseq_optimizer.py | translation/fairseq/optim/fairseq_optimizer.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch
class ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/adam.py | translation/fairseq/optim/adam.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch
import to... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/nag.py | translation/fairseq/optim/nag.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from torch.optim.optimizer import ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/adagrad.py | translation/fairseq/optim/adagrad.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.optim
from . import ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/fp16_optimizer.py | translation/fairseq/optim/fp16_optimizer.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
from fairseq import ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/__init__.py | translation/fairseq/optim/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import importlib
import os
from .... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/sgd.py | translation/fairseq/optim/sgd.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.optim
from . import ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/fixed_schedule.py | translation/fairseq/optim/lr_scheduler/fixed_schedule.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from . import FairseqLRScheduler, ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/cosine_lr_scheduler.py | translation/fairseq/optim/lr_scheduler/cosine_lr_scheduler.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from . import Fairseq... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/inverse_square_root_schedule.py | translation/fairseq/optim/lr_scheduler/inverse_square_root_schedule.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from . import FairseqLRScheduler, ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/triangular_lr_scheduler.py | translation/fairseq/optim/lr_scheduler/triangular_lr_scheduler.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from . import Fairseq... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py | translation/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from .. import FairseqOptimizer
... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/__init__.py | translation/fairseq/optim/lr_scheduler/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import importlib
import os
from .... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py | translation/fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.optim.lr_scheduler
f... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/criterions/label_smoothed_cross_entropy.py | translation/fairseq/criterions/label_smoothed_cross_entropy.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from fairseq import u... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/criterions/cross_entropy.py | translation/fairseq/criterions/cross_entropy.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch.nn.functi... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/criterions/fairseq_criterion.py | translation/fairseq/criterions/fairseq_criterion.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from torch.nn.modules.loss import ... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/criterions/__init__.py | translation/fairseq/criterions/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import importlib
import os
from .... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/criterions/adaptive_loss.py | translation/fairseq/criterions/adaptive_loss.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch.nn.funct... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/linearized_convolution.py | translation/fairseq/modules/linearized_convolution.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn.funct... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/beamable_mm.py | translation/fairseq/modules/beamable_mm.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn as nn... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/grad_multiply.py | translation/fairseq/modules/grad_multiply.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
class GradMultiply(... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/conv_tbc.py | translation/fairseq/modules/conv_tbc.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
from torch.nn.modules... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/highway.py | translation/fairseq/modules/highway.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn.funct... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/downsampled_multihead_attention.py | translation/fairseq/modules/downsampled_multihead_attention.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
#
import math
import torch
import... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/multihead_attention.py | translation/fairseq/modules/multihead_attention.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
from torch import nn
... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/scalar_bias.py | translation/fairseq/modules/scalar_bias.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
#
import torch
class ScalarBias(... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/__init__.py | translation/fairseq/modules/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from .adaptive_softmax import Adap... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/adaptive_softmax.py | translation/fairseq/modules/adaptive_softmax.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn.func... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/sinusoidal_positional_embedding.py | translation/fairseq/modules/sinusoidal_positional_embedding.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import torch
import t... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/character_token_embedder.py | translation/fairseq/modules/character_token_embedder.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import numpy as np
import torch
im... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/modules/learned_positional_embedding.py | translation/fairseq/modules/learned_positional_embedding.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.nn as nn
from fairse... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/data_utils.py | translation/fairseq/data/data_utils.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import contextlib
import os
impor... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/monolingual_dataset.py | translation/fairseq/data/monolingual_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import numpy as np
import torch
f... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/iterators.py | translation/fairseq/data/iterators.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import itertools
import math
impo... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/token_block_dataset.py | translation/fairseq/data/token_block_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import numpy as np
im... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/fairseq_dataset.py | translation/fairseq/data/fairseq_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.utils.data
from fair... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/backtranslation_dataset.py | translation/fairseq/data/backtranslation_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from fairseq import sequence_gene... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/language_pair_dataset.py | translation/fairseq/data/language_pair_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import numpy as np
import torch
f... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/dictionary.py | translation/fairseq/data/dictionary.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from collections import Counter
im... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/__init__.py | translation/fairseq/data/__init__.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from .dictionary import Dictionary... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
zhuohan123/macaron-net | https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/translation/fairseq/data/indexed_dataset.py | translation/fairseq/data/indexed_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import os
import struct
import nu... | python | BSD-3-Clause | 3a84e7a3323bd1a3a9a303194ba336d670a1fb2c | 2026-01-05T07:14:10.995304Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/train_cddsa.py | code/train_cddsa.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2022-12-20 19:10
# @Author : Ran Gu
"""
Apply feature disentanglement and novel contrastive learning in multi sites fundus segmentation
"""
import argparse
import logging
import os
import sys
import yaml
import math
import tqdm
import random
import torch
import ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/test_cddsa_fundus.py | code/test_cddsa_fundus.py | #!/usr/bin/env python
import os
import cv2
import sys
from numpy.lib.type_check import iscomplex
import pytz
import tqdm
import torch
import random
import argparse
import numpy as np
import os.path as osp
import torch.nn.functional as F
from torchvision import transforms
from torch.autograd import Variable
from torch.... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/settings.py | code/settings.py | import ast
import configparser
from collections.abc import Mapping
class Settings(Mapping):
def __init__(self, setting_file='settings.ini'):
config = configparser.ConfigParser()
config.read(setting_file)
self.settings_dict = _parse_values(config)
def __getitem__(self, key):
re... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/train_cscada.py | code/train_cscada.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/6 16:48
# @Author : Ran.Gu
# @Email : guran924@std.uestc.edu.cn
'''
This code is for 'Contrastive Semi-supervised Learning for Cross Anatomical Structure Domain Adaptative Segmentation'.
We used mean teacher as the backbone for semi-supervised domain adaptation across orga... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/test_cscada_mscmrseg.py | code/test_cscada_mscmrseg.py | import os
import torch
import random
import cv2
import numpy as np
import pandas as pd
import torch.utils.data as Data
import torch.nn.functional as F
from distutils.version import LooseVersion
from dataloader.ms_cmr.Cmr_dataloader import CmrsegDataset, ToTensor
from settings import Settings
from torchvision import tra... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/weight_init.py | code/models/weight_init.py | import torch
import os
import sys
def init_dcgan_weights(model):
for m in model.modules():
if isinstance(m, torch.nn.Conv2d):
m.weight.data.normal_(0.0, 0.02)
if m.bias is not None:
m.bias.data.zero_()
def initialize_weights(model, init = "xavier"):... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/layers/blocks.py | code/models/layers/blocks.py | import torch.nn as nn
from models.layers.dsbn import DomainSpecificBatchNorm2d
def normalize(x, norm_type, num_domain=1):
if norm_type == 'batchnorm':
return nn.BatchNorm2d(x)
elif norm_type == 'instancenorm':
return nn.InstanceNorm2d(x)
elif norm_type == 'dsbn':
return DomainSpecif... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/layers/adain.py | code/models/layers/adain.py | import torch
def calc_vector_mean_std(feat, eps=1e-5):
# eps is a small value added to the variance to avoid divide-by-zero.
size = feat.size()
feat_var = feat.var(dim=1) + eps
feat_std = feat_var.sqrt()
feat_mean = feat.mean(dim=1)
return feat_mean, feat_std
def calc_tensor_mean_std(feat, eps... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/layers/dsbn.py | code/models/layers/dsbn.py | import numpy as np
from torch import nn
class _DomainSpecificBatchNorm(nn.Module):
_version = 2
def __init__(self, num_features, num_classes, eps=1e-5, momentum=0.1, affine=True,
track_running_stats=True):
super(_DomainSpecificBatchNorm, self).__init__()
# self.bns = ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/layers/__init__.py | code/models/layers/__init__.py | from .adain import *
from .blocks import * | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/networks/decoder.py | code/models/networks/decoder.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time :
# @Author : Ran Gu
"""
AdaIN-based decoder
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, input_dim, output_dim, dim):
super(MLP, self).__init__()
self.fc1 = nn.Linear(input_d... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/networks/cscada_net.py | code/models/networks/cscada_net.py | # -*- coding: utf-8 -*-
# @Time : 2021/7/21 16:48
# @Author : Ran.Gu
# @Email : guran924@std.uestc.edu.cn
'''
cs-cada uses different normalization.
'''
import random
import torch
import torch.nn as nn
from models.layers.dsbn import DomainSpecificBatchNorm2d
class Unet_dsbn_cont(nn.Module):
def __init__(self,... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/models/networks/sdnet.py | code/models/networks/sdnet.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
sys.path.append("/gr/Project/domain/my work/DAG4MIA/code")
import time
from models.layers.blocks import *
from models.layers.adain import *
from models.networks.decoder import Ada_Decoder
class Segmentor(nn.Module):
def __init__(self, ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/utils/binary.py | code/utils/binary.py | # Copyright (C) 2013 Oskar Maier
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | true |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/utils/utils_fundus.py | code/utils/utils_fundus.py | import os.path as osp
import numpy as np
import os
import cv2
import random
from skimage import morphology
import scipy
from PIL import Image
from matplotlib.pyplot import imsave
# from keras.preprocessing import image
from skimage.measure import label, regionprops
from skimage.transform import rotate, resize
from skim... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/utils/losses.py | code/utils/losses.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/5/6 16:55
# @Author : Ran.Gu
import torch
import numpy as np
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
def get_soft_label(input_tensor, num_class):
"""
convert a label tensor to soft label
input_tensor: tens... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/utils/average_meter.py | code/utils/average_meter.py | class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0.
self.avg = 0.
self.sum = 0.
self.count = 0.
def update(self, val, n=1):
self.val = val
self.sum +... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/dataloader/ms_cmr/make_datalist.py | code/dataloader/ms_cmr/make_datalist.py | '''
This is for MS-CMRSeg challenge dataset
'''
import os, sys
import re
import math
import random
import numpy as np
os.chdir(sys.path[0])
DATA_PATH = '../../Data/MSCMR_C0_45/image'
SAVE_PATH = '.'
def tryint(s):
try:
return int(s)
except ValueError:
return s
def str2int(v_str):
return ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/dataloader/ms_cmr/Cmr_dataloader.py | code/dataloader/ms_cmr/Cmr_dataloader.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/5/8 22:02
# @Author : Ran.Gu
'''
Define a dataset class for MS-CMRSeg challenge (.png, .jpg) dataset
'''
import os
import torch
import numpy as np
import itertools
import imageio
import cv2
import random
import matplotlib.pyplot as plt
from os import listdi... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/dataloader/ms_fundus/Refuge_dataloader.py | code/dataloader/ms_fundus/Refuge_dataloader.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/5/8 22:02
# @Author : Ran.Gu
'''
Define a dataset class for REFUGE challenge (.png, .jpg) dataset
'''
import os
import torch
import numpy as np
import cv2
import imageio
import matplotlib.pyplot as plt
from os import listdir
from os.path import join
from PI... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/dataloader/ms_fundus/fundus_dataloader.py | code/dataloader/ms_fundus/fundus_dataloader.py | from __future__ import print_function, division
import os
import sys
from PIL import Image
import numpy as np
from torch.utils.data import Dataset
from glob import glob
import random
import copy
class FundusSegmentation(Dataset):
"""
Fundus segmentation dataset
including 4 domain dataset
one for test ... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
HiLab-git/DAG4MIA | https://github.com/HiLab-git/DAG4MIA/blob/274e83c2ee0a90d06d9d1529d6526f9af6271055/code/dataloader/ms_fundus/fundus_transforms.py | code/dataloader/ms_fundus/fundus_transforms.py | import torch
import math
import numbers
import random
import numpy as np
from PIL import Image, ImageOps
from scipy.ndimage.filters import gaussian_filter
from matplotlib.pyplot import imshow, imsave
from scipy.ndimage.interpolation import map_coordinates
import cv2
from scipy import ndimage
def to_multilabel(pre_ma... | python | MIT | 274e83c2ee0a90d06d9d1529d6526f9af6271055 | 2026-01-05T07:14:10.960732Z | false |
bilibili/apk-channelization | https://github.com/bilibili/apk-channelization/blob/9efeb80e5cbdc04c020efc056e92a10ef6f13ef5/updatetime.py | updatetime.py | #!/usr/bin/env python
import os, time
def update_file_time(dir_path):
for root,dirs,files in os.walk(dir_path):
for file in files:
file_path = os.path.join(root, file)
st = os.stat(file_path)
mtime = time.localtime(st.st_mtime)
file_time = mtime[0:6]
... | python | MIT | 9efeb80e5cbdc04c020efc056e92a10ef6f13ef5 | 2026-01-05T07:14:11.833453Z | false |
bilibili/apk-channelization | https://github.com/bilibili/apk-channelization/blob/9efeb80e5cbdc04c020efc056e92a10ef6f13ef5/signingapks.py | signingapks.py | #!/usr/bin/env python
import sys, getopt, os
apkfiles = []
zipalignexe = None
class signingConfig:
verbose = False
keystore = None
storepass = None
keyalias = None
keypass = None
def usage():
print 'Usage: ./signingapks.py <signingConfig> [--zipalignexe=path/to/zipalign] <apkfile>...'
print... | python | MIT | 9efeb80e5cbdc04c020efc056e92a10ef6f13ef5 | 2026-01-05T07:14:11.833453Z | false |
bilibili/apk-channelization | https://github.com/bilibili/apk-channelization/blob/9efeb80e5cbdc04c020efc056e92a10ef6f13ef5/repackage.py | repackage.py | #!/usr/bin/env python
import getopt, sys, os, zipfile, shutil, traceback, struct, signingapks, updatetime
class options:
channels = []
apkfile = None
output = None
def usage():
print 'Usage: %s [options] <path/to/apk>' %(sys.argv[0])
print 'options:\n -c <a,b,c...>\trepackage channels'
print... | python | MIT | 9efeb80e5cbdc04c020efc056e92a10ef6f13ef5 | 2026-01-05T07:14:11.833453Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/imageDepthEstimation.py | imageDepthEstimation.py | import cv2
import tensorflow as tf
import numpy as np
from hitnet import HitNet, ModelType, draw_disparity, draw_depth, CameraConfig, load_img
# Select model type
# model_type = ModelType.middlebury
# model_type = ModelType.flyingthings
model_type = ModelType.eth3d
if model_type == ModelType.middlebury:
model_path ... | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/drivingStereoTest.py | drivingStereoTest.py | import cv2
import pafy
import tensorflow as tf
import numpy as np
import glob
from hitnet import HitNet, ModelType, draw_disparity, draw_depth, CameraConfig
out = cv2.VideoWriter('outpy2.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 30, (881*3,400))
# Get image list
left_images = glob.glob('DrivingStereo images/left/... | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/videoDepthEstimation.py | videoDepthEstimation.py | import cv2
import pafy
import tensorflow as tf
import numpy as np
from hitnet import HitNet, ModelType, draw_disparity, draw_depth, CameraConfig
# Initialize video
# cap = cv2.VideoCapture("video.mp4")
videoUrl = 'https://youtu.be/Yui48w71SG0'
videoPafy = pafy.new(videoUrl)
print(videoPafy.streams)
cap = cv2.VideoCa... | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/hitnet/__init__.py | hitnet/__init__.py | from hitnet.hitnet import HitNet
from hitnet.utils_hitnet import * | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/hitnet/hitnet.py | hitnet/hitnet.py | import tensorflow as tf
import numpy as np
import time
import cv2
from hitnet.utils_hitnet import *
drivingStereo_config = CameraConfig(0.546, 1000)
class HitNet():
def __init__(self, model_path, model_type=ModelType.eth3d, camera_config=drivingStereo_config):
self.fps = 0
self.timeLastPrediction = time.time(... | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
ibaiGorordo/HITNET-Stereo-Depth-estimation | https://github.com/ibaiGorordo/HITNET-Stereo-Depth-estimation/blob/a64564954bfa2eb141bda709e942952a9c3be80f/hitnet/utils_hitnet.py | hitnet/utils_hitnet.py | from enum import Enum
import tensorflow as tf
import numpy as np
import cv2
import urllib
from dataclasses import dataclass
class ModelType(Enum):
eth3d = 0
middlebury = 1
flyingthings = 2
@dataclass
class CameraConfig:
baseline: float
f: float
def wrap_frozen_graph(graph_def, inputs, outputs):
def _impo... | python | MIT | a64564954bfa2eb141bda709e942952a9c3be80f | 2026-01-05T07:14:11.475984Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/media_player.py | custom_components/vaca/media_player.py | """Media player entity for VA Wyoming."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.components import media_source
from homeassistant.components.media_player import (
BrowseMedia,
MediaPlayerDeviceClass,
MediaPlayerEnqueue,
MediaPlayerE... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/client.py | custom_components/vaca/client.py | """Custom AsyncTCPClient for Wyoming events."""
from wyoming.client import AsyncTcpClient
from wyoming.event import Event
class VAAsyncTcpClient(AsyncTcpClient):
"""Custom TCP client for Wyoming events."""
def __init__(
self,
host: str,
port: int,
before_send_callback=None,
... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/assist_satellite.py | custom_components/vaca/assist_satellite.py | """Assist satellite entity for Wyoming integration."""
from __future__ import annotations
import asyncio
import io
import logging
import time
from typing import Final
import wave
from wyoming.audio import AudioChunk, AudioStart, AudioStop
from wyoming.event import Event
from wyoming.info import Describe
from wyoming... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/tts.py | custom_components/vaca/tts.py | """Support for Wyoming text-to-speech services."""
from collections import defaultdict
import io
import logging
import wave
from wyoming.audio import AudioChunk, AudioStop
from wyoming.client import AsyncTcpClient
from wyoming.tts import Synthesize, SynthesizeVoice
from homeassistant.components import tts
from homea... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/switch.py | custom_components/vaca/switch.py | """Wyoming switch entities."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_ON, EntityCategory
from h... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/number.py | custom_components/vaca/number.py | """Number entities for Wyoming integration."""
from __future__ import annotations
from typing import TYPE_CHECKING, Final
from homeassistant.components.number import NumberEntityDescription, RestoreNumber
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeass... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/binary_sensor.py | custom_components/vaca/binary_sensor.py | """Binary Sensor for Wyoming."""
from __future__ import annotations
import asyncio
from asyncio import Task
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassi... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/const.py | custom_components/vaca/const.py | """Constants for the Wyoming integration."""
DOMAIN = "vaca"
MIN_APK_VERSION = "0.8.2"
SAMPLE_RATE = 16000
SAMPLE_WIDTH = 2
SAMPLE_CHANNELS = 1
# For multi-speaker voices, this is the name of the selected speaker.
ATTR_SPEAKER = "speaker"
INTENT_EVENT = f"{DOMAIN}_intent_event"
| python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/devices.py | custom_components/vaca/devices.py | """Class to manage satellite devices."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
from wyoming.info import Info
from homeassistant.components.wyoming import SatelliteDevice
from homeassistant.core import HomeAssistant, callback
... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/wake_word.py | custom_components/vaca/wake_word.py | """Support for Wyoming wake-word-detection services."""
import asyncio
from collections.abc import AsyncIterable
import logging
from wyoming.audio import AudioChunk, AudioStart
from wyoming.client import AsyncTcpClient
from wyoming.wake import Detect, Detection
from homeassistant.components import wake_word
from hom... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/sensor.py | custom_components/vaca/sensor.py | """Sensor for Wyoming."""
from __future__ import annotations
from functools import reduce
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.components.sensor import (
RestoreSensor,
SensorDeviceClass,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
fr... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/__init__.py | custom_components/vaca/__init__.py | """The Wyoming integration."""
from __future__ import annotations
import asyncio
import logging
from typing import Any
from homeassistant.components.wyoming import (
DomainDataItem,
WyomingService,
async_register_websocket_api,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.con... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/entity.py | custom_components/vaca/entity.py | """Wyoming entities."""
from __future__ import annotations
from homeassistant.helpers import entity
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
from .const import DOMAIN
from .devices import VASatelliteDevice
class VASatelliteEntity(entity.Entity):
"""Wyoming satellite entity.... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/button.py | custom_components/vaca/button.py | """Wyoming button entities."""
from __future__ import annotations
from typing import TYPE_CHECKING
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_plat... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/select.py | custom_components/vaca/select.py | """Select entities for Wyoming integration."""
from __future__ import annotations
from typing import TYPE_CHECKING, Final
from homeassistant.components.assist_pipeline import (
AssistPipelineSelect,
VadSensitivity,
VadSensitivitySelect,
)
from homeassistant.components.select import SelectEntity, SelectEn... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
msp1974/ViewAssist_Companion_App | https://github.com/msp1974/ViewAssist_Companion_App/blob/5f4533c753120a8b59087b19fda2b26c42284aa7/custom_components/vaca/custom.py | custom_components/vaca/custom.py | """# Custom components for View Assist satellite integration with Wyoming events."""
from dataclasses import dataclass
from enum import StrEnum
import logging
from typing import Any
from awesomeversion import AwesomeVersion
from wyoming.event import Event, Eventable
from homeassistant.core import HomeAssistant
from ... | python | Apache-2.0 | 5f4533c753120a8b59087b19fda2b26c42284aa7 | 2026-01-05T07:13:44.720990Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.