file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
touchnet/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
# Import the built-in models here so that the corresponding register_model_spec()
# will be called.
from transformers import AutoConfig, AutoModelForCausalLM
from transformers.models.llama import LlamaConfig, LlamaForCausalLM
from trans... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from dataclasses import asdict, dataclass, field, fields
@dataclass
class MakeDataConfig:
"""Configuration object for make_data"""
_argument_group_name = "make_data"
save_dir: str = field(
default="./exp",
... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/convert_dcp_to_hf.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import io
import os
import tempfile
from datetime import timedelta
import torch
import torch.serialization
import transformers
from torch.distributed.checkpoint.format_utils import dcp_... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/convert_hf_to_dcp.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2023-2025, Songlin Yang, Yu Zhang
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import json
import os
from pathlib import Path
import torch
import torch.distributed.checkpoint as DCP
import transformers
from transformers import AutoModelForCausalLM
from transformer... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/make_data.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import json
import multiprocessing
import os
from subprocess import CalledProcessError, run
from typing import List, Type
import numpy
import torch
from transformers.hf_argparser import HfArgumentParser
from touchnet.bin import MakeDa... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/textnorm_zh.py | Python | #!/usr/bin/env python3
# coding=utf-8
# Authors:
# 2019.5 Zhiyang Zhou (https://github.com/Joee1995/chn_text_norm.git)
# 2019.9 - 2022 Jiayu DU
#
# requirements:
# - python 3.X
# notes: python 2.X WILL fail or produce misleading results
import argparse
import csv
import os
import re
import string
import sys
# ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/bin/train.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import os
impo... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/data/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from dataclasses import asdict, dataclass, field, fields
from typing import Any, Dict, List, Optional, Union
@dataclass
class DataConfig:
"""Configuration object for datas"""
_argument_group_name = "data"
datapipe_type: ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/data/dataloader.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import copy
from abc impor... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/data/datapipe.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import json
from typing import Any, Dict
import numpy
import torch
from torch.distributed.checkpoint.stateful import Stateful
from torch.utils.data import IterableDataset
from touchnet.data import DataConfig
from touchnet.data.dataset... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/data/dataset.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# Megatron-LM team.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import os
import struct
import time
from abc import ABC, abstractmethod
from enum import Enum
from types import TracebackType
from typing import List, ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/data/functions.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2021 Mobvoi Inc. (authors: Binbin Zhang)
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# 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
#
#... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/loss/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
def _cross_entropy_loss(
pred: torch.Tensor, labels: torch.Tensor,
reduction: str = "none", ignore_index: int = -100
) -> torch.Tensor:
"""Common cross-entropy loss function for compilation wrapping.
When... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/loss/cross_entropy.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from typing import Tuple
import torch
from torch.distributed.tensor import DTensor, Replicate
from touchnet.loss import COMPILED_LOSSES
def cross_entropy_loss(
pred: torch.Tensor, labels: torch.Tensor,
sentence_lens: torch.T... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
| xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/helper_func.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D parallelisms (except p... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
from transformers.models.qwen2.modeling_qwen2 import Qwen2RMSNorm
from touchnet.models.kimi_audio.configuration_kimi_audio import KimiAudioConfig
from touchnet.models.kimi_audio.modeling_kimi_audio import \
MoonshotKim... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/configuration_kimi_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, The Moonshot AI Team
# Xingchen Song(sxc19@tsinghua.org.cn)
from transformers import Qwen2Config, WhisperConfig
# NOTE(xcsong): `WhisperVQConfig` for audio tokenizer
class WhisperVQConfig(WhisperConfig):
def __init__(self,
pooling... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/inference_kimi_audio.py | Python | # Copyright (c) 2025 Tsinghua Univ. (authors: Xingchen Song)
#
# 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 applicab... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/modeling_kimi_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, The Moonshot AI Team, Qwen Team, and HuggingFace Inc. team. All rights reserved.
# Xingchen Song(sxc19@tsinghua.org.cn)
#
# The code is based on Qwen2.5-7B, but modified for KimiAudio.
#
# Licensing Information:
# - Code derived from Qwen2.5-7B is licens... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/parallelize_kimi_audio.py | Python | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D parallelisms (except ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/kimi_audio/processing_kimi_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
from torch.nn.utils.rnn import pad_sequence
from transformers import WhisperFeatureExtractor
from touchnet.data import DataConfig
from touchnet.data.datapipe import LowLevelTouchDatapipe, MidLevelTouchDatapipe
from touchne... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/llama/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
from liger_kernel.transformers import apply_liger_kernel_to_llama
from transformers.models.llama import LlamaConfig, LlamaForCausalLM
from touchnet.bin import TrainConfig
def pre_init(args: TrainConfig):
"""Pre-initi... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/llama/parallelize_llama.py | Python | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D parallelisms (except ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/llama/pipeline_llama.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D pipeline parallelism t... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/llama/processing_llama.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2021 Mobvoi Inc. (authors: Binbin Zhang)
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# 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
#
#... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/qwen2_audio/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from typing import Optional, Tuple, Union
import torch
from liger_kernel.transformers import apply_liger_kernel_to_qwen2
from transformers.cache_utils import Cache
from transformers.modeling_outputs import BaseModelOutput
from transfor... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/qwen2_audio/inference_qwen2_audio.py | Python | # Copyright (c) 2025 Tsinghua Univ. (authors: Xingchen Song)
#
# 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 applicab... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/qwen2_audio/parallelize_qwen2_audio.py | Python | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D parallelisms (except ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/qwen2_audio/processing_qwen2_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
import transformers
from torch.nn.utils.rnn import pad_sequence
from transformers.models.qwen2_audio.processing_qwen2_audio import \
Qwen2AudioProcessor
from touchnet.data import DataConfig
from touchnet.data.datapipe ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
import torch
from liger_kernel.transformers import (apply_liger_kernel_to_llama,
apply_liger_kernel_to_qwen2)
from touchnet.bin import TrainConfig
from touchnet.models.touch_audio.configuration_to... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/configuration_touch_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from transformers.configuration_utils import PretrainedConfig
from transformers.models.auto import CONFIG_MAPPING, AutoConfig
class TouchAudioProjectorConfig(PretrainedConfig):
model_type = "touch_audio_projector"
def __init_... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/inference_touch_audio.py | Python | # Copyright (c) 2025 Tsinghua Univ. (authors: Xingchen Song)
#
# 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 applicab... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/modeling_touch_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from typing import Any, List, Optional, Tuple, Union
import torch
from transformers.cache_utils import Cache
from transformers.generation.utils import GenerationMixin
from transformers.modeling_outputs import CausalLMOutputWithPast
fro... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/parallelize_touch_audio.py | Python | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This file applies the PT-D parallelisms (except ... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/models/touch_audio/processing_touch_audio.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2021 Mobvoi Inc. (authors: Binbin Zhang)
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# 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
#
#... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/tokenizer/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
from dataclasses import asdict, dataclass, field, fields
@dataclass
class TokenizerConfig:
"""Configuration object for tokenizer"""
_argument_group_name = "tokenizer"
tokenizer_model: str = field(
default=None,
... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/tokenizer/tokenizer.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2023, NVIDIA CORPORATION (Megatron-LM teams).
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
"""Touch tokenizers."""
import json
from abc import ABC, abstractmethod
from collections import OrderedDict
from typing import Any, Union
import numpy
import torch
import t... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/__init__.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) 2025, Xingchen Song(sxc19@tsinghua.org.cn)
| xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/checkpoint.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import enum
import functools
import os
import queue... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/distributed.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import gc
import math
import os
i... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/inference.py | Python | # Copyright (c) 2025 Tsinghua Univ. (authors: Xingchen Song)
#
# 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 applicab... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/logging.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from dataclasses import da... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/metrics.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import subprocess
import time
from collec... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/optimizer.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import copy
import functools
import math
from typin... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/profiling.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import os
import pickle
import ti... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
touchnet/utils/train_spec.py | Python | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# 2025, Xingchen Song(sxc19@tsinghua.org.cn)
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
from typing impor... | xingchensong/TouchNet | 224 | A native-PyTorch library for large scale M-LLM (text/audio) training with tp/cp/dp. | Python | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.onnx/export_onnx.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2024-01-09] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import argparse
import torch
import os
import onnx
import logging
from model.model import ModelArgs, Transformer
def main():
logging.basicConfig(level=logging.DEBUG,
forma... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.onnx/model/group_conv.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2023-12-18] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import copy
import torch
import numpy as np
class HorizonGroupConv(torch.nn.Module):
def __init__(self, module, block_size=32):
super().__init__()
original = copy.deepcopy(module)
... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.onnx/model/model.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# This software may be used and distributed according to the terms of
# the Llama 2 Community License Agreement.
import math
from dataclasses import dataclass
from typing import Optional, Tuple
import torch
import to... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.trace/model/group_conv.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2023-12-18] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import copy
import torch
import numpy as np
class HorizonGroupConv(torch.nn.Module):
def __init__(self, module, block_size=32):
super().__init__()
original = copy.deepcopy(module)
... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.trace/model/model.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# This software may be used and distributed according to the terms of
# the Llama 2 Community License Agreement.
import math
from dataclasses import dataclass
from typing import Optional, Tuple
import torch
import to... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llama2.trace/trace.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2023-12-18] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import argparse
import torch
import os
import logging
from hbdk4.compiler.torch import statistics
from model.model import ModelArgs, Transformer
def main():
logging.basicConfig(level=logging.DEB... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/convert-h5-to-ggml.py | Python | # Convert MNIS h5 transformer model to ggml format
#
# Load the (state_dict) saved model using PyTorch
# Iterate over all variables and write them to a binary file.
#
# For each variable, write the following:
# - Number of dimensions (int)
# - Name length (int)
# - Dimensions (int[n_dims])
# - Name (char[name_l... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/include/ggml/ggml-alloc.h | C/C++ Header | #pragma once
#include "ggml.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ggml_backend;
struct ggml_backend_buffer;
//
// Legacy API
//
typedef struct ggml_allocr * ggml_allocr_t;
// initialize allocator for use with CPU backend only
GGML_API ggml_allocr_t ggml_allocr_new(void * data, size_t size, size_t alig... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/include/ggml/ggml-backend.h | C/C++ Header | #pragma once
#include "ggml.h"
#include "ggml-alloc.h"
#ifdef __cplusplus
extern "C" {
#endif
//
// Backend buffer
//
struct ggml_backend_buffer;
typedef struct ggml_backend_buffer * ggml_backend_buffer_t;
// backend buffer functions
GGML_API void ggml_backend_buffer_free (g... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/include/ggml/ggml.h | C/C++ Header | #pragma once
//
// GGML Tensor Library
//
// This documentation is still a work in progress.
// If you wish some specific topics to be covered, feel free to drop a comment:
//
// https://github.com/ggerganov/whisper.cpp/issues/40
//
// ## Overview
//
// This library implements:
//
// - a set of tensor operations
//... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/main.cpp | C++ | #include "ggml/ggml.h"
#include "common.h"
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
// default hparams
struct mnist_hpar... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/quantize.cpp | C++ | #include "ggml/ggml.h"
#include "common.h"
#include "common-ggml.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <map>
#include <string>
#include <vector>
#include <regex>
// default hparams
struct mnist_hparams {
int32_t n_input = 784;
int32_t n_hidd... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/common-ggml.cpp | C++ | #include "common-ggml.h"
#include <regex>
#include <map>
static const std::map<std::string, enum ggml_ftype> GGML_FTYPE_MAP = {
{"q4_0", GGML_FTYPE_MOSTLY_Q4_0},
{"q4_1", GGML_FTYPE_MOSTLY_Q4_1},
{"q5_0", GGML_FTYPE_MOSTLY_Q5_0},
{"q5_1", GGML_FTYPE_MOSTLY_Q5_1},
{"q8_0", GGML_FTYPE_MOSTLY_Q8_0},
... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/common-ggml.h | C/C++ Header | #pragma once
#include "ggml.h"
#include <fstream>
#include <vector>
#include <string>
enum ggml_ftype ggml_parse_ftype(const char * str);
void ggml_print_ftypes(FILE * fp = stderr);
bool ggml_common_quantize_0(
std::ifstream & finp,
std::ofstream & fout,
const ggml_ftype ftype,
cons... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/common.cpp | C++ | #define _USE_MATH_DEFINES // for M_PI
#include "common.h"
// third-party utilities
// use your favorite implementations
#define DR_WAV_IMPLEMENTATION
#include "dr_wav.h"
#include <cmath>
#include <cstring>
#include <fstream>
#include <regex>
#include <locale>
#include <codecvt>
#include <sstream>
#if defined(_MSC_V... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/common.h | C/C++ Header | // Various helper functions and utilities
#pragma once
#include <string>
#include <map>
#include <vector>
#include <random>
#include <thread>
#include <ctime>
#include <fstream>
#define COMMON_SAMPLE_RATE 16000
//
// GPT CLI argument parsing
//
struct gpt_params {
int32_t seed = -1; // RNG seed
i... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/dr_wav.h | C/C++ Header | /*
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_wav - v0.12.16 - 2020-12-02
David Reid - mackron@gmail.com
GitHub: https://github.com/mackron/dr_libs
*/
/*
RELEASE NOTES - VERSION 0.12
============================
Version 0.12 includes breaking cha... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-alloc.c | C | #include "ggml-alloc.h"
#include "ggml-backend-impl.h"
#include "ggml.h"
#include "ggml-impl.h"
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MAX_FREE_BLOCKS 256
//#define GGML_ALLOCATOR_DEBUG
/... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-backend-impl.h | C/C++ Header | #pragma once
// ggml-backend internal header
#include "ggml-backend.h"
#ifdef __cplusplus
extern "C" {
#endif
//
// Backend buffer
//
typedef void * ggml_backend_buffer_context_t;
struct ggml_backend_buffer_i {
void (*free_buffer) (ggml_backend_buffer_t buffer);
void * (*g... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-backend.c | C | #include "ggml-backend-impl.h"
#include "ggml-alloc.h"
#include "ggml-impl.h"
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define UNUSED GGML_UNUSED
#define MAX(a, b) ((a) > (b) ? (a) : (b))
// backend buffer
ggml_backend_buffer_t ggml_back... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-cuda.cu | CUDA | #include <algorithm>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <stdint.h>
#include <stdio.h>
#include <atomic>
#include <assert.h>
#if defined(GGML_USE_HIPBLAS)
#include <hip/hip_runtime.h>
#include <hipblas/hipblas.h>
#include <hip/hip_fp16.h>
#ifdef __HIP_PLATFORM_AMD__
// for rocblas_initiali... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-cuda.h | C/C++ Header | #pragma once
#include "ggml.h"
#include "ggml-backend.h"
#ifdef GGML_USE_HIPBLAS
#define GGML_CUDA_NAME "ROCm"
#define GGML_CUBLAS_NAME "hipBLAS"
#else
#define GGML_CUDA_NAME "CUDA"
#define GGML_CUBLAS_NAME "cuBLAS"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define GGML_CUDA_MAX_DEVICES 16
// Always suc... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-impl.h | C/C++ Header | #pragma once
#include "ggml.h"
// GGML internal header
#include <assert.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h> // memcpy
#include <math.h> // fabsf
#ifdef __cplusplus
extern "C" {
#endif
// static_assert should be a #define, but if it's not,
// fall back to the _Static_assert C11 keyword... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-metal.h | C/C++ Header | // An interface allowing to compute ggml_cgraph with Metal
//
// This is a fully functional interface that extends ggml with GPU support for Apple devices.
// A similar interface can be created for other GPU backends (e.g. Vulkan, CUDA, OpenCL, etc.)
//
// How it works?
//
// As long as your program can create and eval... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-metal.m | Objective-C | #import "ggml-metal.h"
#import "ggml-backend-impl.h"
#import "ggml.h"
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
#undef MIN
#undef MAX
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#ifdef GGML_METAL_NDEBUG
#define GGML_METAL_LOG_INFO(...)
#define GGML_METAL_LOG_... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-opencl.cpp | C++ | #include "ggml-opencl.h"
#include <array>
#include <atomic>
#include <sstream>
#include <vector>
#include <limits>
#define CL_TARGET_OPENCL_VERSION 110
#include <clblast.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ggml.h"
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // poss... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-opencl.h | C/C++ Header | #pragma once
#include "ggml.h"
#ifdef __cplusplus
extern "C" {
#endif
void ggml_cl_init(void);
void ggml_cl_mul(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_tensor * dst);
bool ggml_cl_can_mul_mat(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_ten... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-quants.c | C | #include "ggml-quants.h"
#include "ggml-impl.h"
#include <math.h>
#include <string.h>
#include <assert.h>
#include <float.h>
#ifdef __ARM_NEON
// if YCM cannot find <arm_neon.h>, make a symbolic link to it, for example:
//
// $ ln -sfn /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/arm_neon.h ./s... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml-quants.h | C/C++ Header | #pragma once
#include "ggml-impl.h"
// GGML internal header
#include <stdint.h>
#include <stddef.h>
#define QK4_0 32
typedef struct {
ggml_fp16_t d; // delta
uint8_t qs[QK4_0 / 2]; // nibbles / quants
} block_q4_0;
static_assert(sizeof(block_q4_0) == sizeof(ggml_fp16_t) + QK4_0 / 2, "wrong q4_0 bl... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/src/ggml.c | C | #define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnigns on Windows
#define _USE_MATH_DEFINES // For M_PI on MSVC
#include "ggml-impl.h"
#include "ggml-quants.h"
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h> // using malloc.h with MSC/MINGW
#elif !defined(__FreeBSD__) && !defined(... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/ggml/train.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2023-11-17] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
input_size = 784 # img_size = (28,28) ---> 28*2... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/refc/convert_state_dict.py | Python | import torch
import sys
import numpy as np
if len(sys.argv) != 3:
print("Usage: convert-state_dict.py ./assets/mnist_model.state_dict " +
"./assets/xcml-model-f32.txt\n")
sys.exit(1)
state_dict_file = sys.argv[1]
fname_out = sys.argv[2]
state_dict = torch.load(state_dict_file, map_location=torch.de... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/llm.int4/refc/main.cpp | C++ | // Copyright [2023-11-17] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
#include <bits/stdc++.h>
#include <immintrin.h>
#define N_INPUT 784
#define N_HIDDEN 512
#define N_ClASSES 10
#define QK8_0 32
#define FP16_TO_FP32(x) _cvtsh_ss(x)
#define FP32_TO_FP16(x) _cvtss_sh(x, 0)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
horizon/x3/analyze.py | Python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright [2023-11-07] <sxc19@mails.tsinghua.edu.cn, Xingchen Song>
import json
import sys
profile_path = sys.argv[1]
with open(profile_path, "r") as f:
cont = f.readlines()
tot_result = json.loads("".join(cont[:13]))
result = json.loads("".join(cont[14:]... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
llm/WeNetxLLM/train.sh | Shell | export HF_HOME=/bucket/output/jfs-hdfs/user/xingchen.song/share/huggingface
torchrun --nproc_per_node=8 --nnodes=1 \
--rdzv_id=2024 --rdzv_backend="c10d" --rdzv_endpoint="localhost:0" \
train_qwen.py \
--device "cuda" \
--output_dir "exp" \
--batch_size 8 \
--num_workers 4 \
... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
llm/WeNetxLLM/train_qwen.py | Python | import os
import argparse
import torch
import torch.distributed as dist
import datasets
from torch.nn.utils import clip_grad_norm_
from transformers import Qwen2Config, Qwen2Tokenizer, Qwen2ForCausalLM
from torch.utils.data import DataLoader, Dataset, DistributedSampler
from tqdm import tqdm
config = {
"architectu... | xingchensong/playground | 2 | happy developing | C | xingchensong | Xingchen Song(宋星辰) | Tsinghua University (2019-2022), WeNet Community (2021-now) |
experiments/ctdet_coco_dla_1x.sh | Shell | cd src
# train
python main.py ctdet --exp_id coco_dla_1x --batch_size 128 --master_batch 9 --lr 5e-4 --gpus 0,1,2,3,4,5,6,7 --num_workers 16
# test
python test.py ctdet --exp_id coco_dla_1x --keep_res --resume
# flip test
python test.py ctdet --exp_id coco_dla_1x --keep_res --resume --flip_test
# multi scale test
pyth... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_coco_dla_2x.sh | Shell | cd src
# train
python main.py ctdet --exp_id coco_dla_2x --batch_size 128 --master_batch 9 --lr 5e-4 --gpus 0,1,2,3,4,5,6,7 --num_workers 16 --num_epochs 230 lr_step 180,210
# or use the following command if your have coco_s2_dla_1x trained
# python main.py ctdet --exp_id coco_dla_2x --batch_size 128 --master_batch 9 -... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_coco_hg.sh | Shell | cd src
# train
python main.py ctdet --exp_id coco_hg --arch hourglass --batch_size 24 --master_batch 4 --lr 2.5e-4 --load_model ../models/ExtremeNet_500000.pth --gpus 0,1,2,3,4
# test
python test.py ctdet --exp_id coco_hg --arch hourglass --keep_res --resume
# flip test
python test.py ctdet --exp_id coco_hg --arch hour... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_coco_resdcn101.sh | Shell | cd src
# train
python main.py ctdet --exp_id coco_resdcn101 --arch resdcn_101 --batch_size 96 --master_batch 5 --lr 3.75e-4 --gpus 0,1,2,3,4,5,6,7 --num_workers 16
# test
python test.py ctdet --exp_id coco_resdcn101 --keep_res --resume
# flip test
python test.py ctdet --exp_id coco_resdcn101 --keep_res --resume --flip_... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_coco_resdcn18.sh | Shell | cd src
# train
python main.py ctdet --exp_id coco_resdcn18 --arch resdcn_18 --batch_size 114 --master_batch 18 --lr 5e-4 --gpus 0,1,2,3 --num_workers 16
# test
python test.py ctdet --exp_id coco_resdcn18 --arch resdcn_18 --keep_res --resume
# flip test
python test.py ctdet --exp_id coco_resdcn18 --arch resdcn_18 --keep... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_dla_384.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_dla_384 --dataset pascal --num_epochs 70 --lr_step 45,60
# test
python test.py ctdet --exp_id pascal_dla_384 --dataset pascal --resume
# flip test
python test.py ctdet --exp_id pascal_dla_384 --dataset pascal --resume --flip_test
cd ..
| xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_dla_512.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_dla_512 --dataset pascal --input_res 512 --num_epochs 70 --lr_step 45,60 --gpus 0,1
# test
python test.py ctdet --exp_id pascal_dla_512 --dataset pascal --input_res 512 --resume
# flip test
python test.py ctdet --exp_id pascal_dla_512 --dataset pascal --input_res 512 ... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_resdcn101_384.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_resdcn101_384 --arch resdcn_101 --dataset pascal --num_epochs 70 --lr_step 45,60 --gpus 0,1
# test
python test.py ctdet --exp_id pascal_resdcn101_384 --arch resdcn_101 --dataset pascal --resume
# flip test
python test.py ctdet --exp_id pascal_resdcn101_384 --arch resd... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_resdcn101_512.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_resdcn101_512 --arch resdcn_101 --dataset pascal --input_res 512 --num_epochs 70 --lr_step 45,60 --gpus 0,1,2,3
# test
python test.py ctdet --exp_id pascal_resdcn101_512 --arch resdcn_101 --dataset pascal --input_res 512 --resume
# flip test
python test.py ctdet --exp... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_resdcn18_384.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_resdcn18_384 --arch resdcn_18 --dataset pascal --num_epochs 70 --lr_step 45,60
# test
python test.py ctdet --exp_id pascal_resdcn18_384 --arch resdcn_18 --dataset pascal --resume
# flip test
python test.py ctdet --exp_id pascal_resdcn18_384 --arch resdcn_18 --dataset ... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ctdet_pascal_resdcn18_512.sh | Shell | cd src
# train
python main.py ctdet --exp_id pascal_resdcn18_512 --arch resdcn_18 --dataset pascal --input_res 512 --num_epochs 70 --lr_step 45,60
# test
python test.py ctdet --exp_id pascal_resdcn18_512 --arch resdcn_18 --dataset pascal --input_res 512 --resume
# flip test
python test.py ctdet --exp_id pascal_resdcn18... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ddd_3dop.sh | Shell | cd src
# train
python main.py ddd --exp_id 3dop --dataset kitti --kitti_split 3dop --batch_size 16 --master_batch 7 --num_epochs 70 --lr_step 45,60 --gpus 0,1
# test
python test.py ddd --exp_id 3dop --dataset kitti --kitti_split 3dop --resume
cd ..
| xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/ddd_sub.sh | Shell | cd src
# train
python main.py ddd --exp_id sub --dataset kitti --kitti_split subcnn --batch_size 16 --master_batch 7 --num_epochs 70 --lr_step 45,60 --gpus 0,1
# test
python test.py ddd --exp_id sub --dataset kitti --kitti_split subcnn --resume
cd ..
| xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/exdet_coco_dla.sh | Shell | cd src
# train
python main.py exdet --exp_id coco_dla --batch_size 64 --master_batch 1 --lr 2.5e-4 --gpus 0,1,2,3,4,5,6,7 --num_workers 8
# test
python test.py exdet --exp_id coco_dla --keep_res --resume
# flip test
python test.py exdet --exp_id coco_dla --keep_res --resume --flip_test
# multi scale test
python test.p... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/exdet_coco_hg.sh | Shell | cd src
# train
python main.py exdet --exp_id coco_hg --arch hourglass --batch_size 24 --master_batch 4 --lr 2.5e-4 --gpus 0,1,2,3,4
# test
python test.py exdet --exp_id coco_hg --arch hourglass --keep_res --resume
# flip test
python test.py exdet --exp_id coco_hg --arch hourglass --keep_res --resume --flip_test
# mult... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/multi_pose_dla_1x.sh | Shell | cd src
# train
python main.py multi_pose --exp_id dla_1x --dataset coco_hp --batch_size 128 --master_batch 9 --lr 5e-4 --load_model ../models/ctdet_coco_dla_2x.pth --gpus 0,1,2,3,4,5,6,7 --num_workers 16
# test
python test.py multi_pose --exp_id dla_1x --dataset coco_hp --keep_res --resume
# flip test
python test.py mu... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
experiments/multi_pose_dla_3x.sh | Shell | cd src
# train
python main.py multi_pose --exp_id dla_3x --dataset coco_hp --batch_size 128 --master_batch 9 --lr 5e-4 --load_model ../models/ctdet_coco_dla_2x.pth --gpus 0,1,2,3,4,5,6,7 --num_workers 16 --num_epochs 320 lr_step 270,300
# or use the following command if your have dla_1x trained
# python main.py multi_p... | xingyizhou/CenterNet | 7,541 | Object detection, 3D detection, and pose estimation using center point detection: | Python | xingyizhou | Xingyi Zhou | Meta |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.