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
docs/examples/name-property/index.html
HTML
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><my-element> ⌲ Examples ⌲ Name Property</title> <link rel="stylesheet" href="../../docs.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
docs/index.html
HTML
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><my-element> ⌲ Home</title> <link rel="stylesheet" href="docs.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
docs/install/index.html
HTML
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><my-element> ⌲ Install</title> <link rel="stylesheet" href="../docs.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:30...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
docs/my-element.bundled.js
JavaScript
/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ var t,i,s,e;const o=globalThis.trustedTypes,n=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,h=`lit$${(Math.random()+"").slice(9)}$`,l="?"+h,r=`<${l}>`,u=document,d=(t="")=>u.createComment(t),c=t=>null===t||"object"!=typeof...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
docs/prism-okaidia.css
CSS
/** * okaidia theme for JavaScript, CSS and HTML * Loosely based on Monokai textmate theme by http://www.monokai.nl/ * @author ocodia */ code[class*="language-"], pre[class*="language-"] { color: #f8f8f2; background: none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); font-family: Consolas, Monaco, 'Andale Mono', 'Ub...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
rollup.config.js
JavaScript
/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import summary from 'rollup-plugin-summary'; import {terser} from 'rollup-plugin-terser'; import resolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; export default { input: 'my-element.js'...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
src/my-element.ts
TypeScript
/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import {LitElement, html, css} from 'lit'; import {customElement, property} from 'lit/decorators.js'; /** * An example element. * * @slot - This element has a slot * @csspart button - The button */ @customElement('my-elemen...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
src/test/my-element_test.ts
TypeScript
/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import {MyElement} from '../my-element.js'; import {fixture, html} from '@open-wc/testing'; const assert = chai.assert; suite('my-element', () => { test('is defined', () => { const el = document.createElement('my-element...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
web-dev-server.config.js
JavaScript
/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import {legacyPlugin} from '@web/dev-server-legacy'; export default { nodeResolve: true, preserveSymlinks: true, plugins: [ legacyPlugin({ polyfills: { // Manually imported in index.html file webc...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
web-test-runner.config.js
JavaScript
/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import {legacyPlugin} from '@web/dev-server-legacy'; import {playwrightLauncher} from '@web/test-runner-playwright'; // Uncomment for testing on Sauce Labs // Must run `npm i --save-dev @web/test-runner-saucelabs` and set // SAU...
xiekw2010/lit-component-play
0
lit component play
JavaScript
xiekw2010
David Tse
Alipay
controllers/api/looks.js
JavaScript
/*! * mojing - controllers/task.js * Copyright(c) 2014 ju.taobao.com * Author: jianhui.fjh <jianhui.fjh@alibaba-inc.com> */ 'use strict'; exports.allLooks = function* () { this.body = { "hi": 'xiekw' } };
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
crawler.js
JavaScript
/** * Created by xiekaiwei on 16/6/23. */ "use strict"; const Crawler = require('simplecrawler'); const cheerio = require('cheerio'); const fs = require('fs'); const path = require('path'); const redis = require('./storage/redis'); const TEMP_HOT_PATH = 'http://www.wxcha.com/biaoqing/hot_'; const TEMP_RECENT_PATH ...
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
index.js
JavaScript
'use strict'; const koa = require('koa'); const logger = require('koa-logger'); const onerror = require('koa-onerror'); const routes = require('./routes'); const crawler = require('./crawler'); require('./storage/redis'); const app = koa(); // middlewares app.use(logger()); onerror(app); routes(app); // listen app.l...
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
localStart.sh
Shell
#!/usr/bin/env bash /Users/xiekaiwei/Downloads/redis-3.2.1/src/redis-server
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
routes.js
JavaScript
/*! * mojing - routes.js * Copyright(c) 2014 ju.taobao.com * Author: jianhui.fjh <jianhui.fjh@alibaba-inc.com> */ 'use strict'; /** * Module dependencies. */ const route = require('koa-route'); const looks = require('./controllers/api/looks'); module.exports = function (app) { app.use(route.get('/api/allLook...
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
storage/redis.js
JavaScript
/** * Created by xiekaiwei on 16/6/24. */ "use strict"; var redis = require("redis"); // if you'd like to select database 3, instead of 0 (default), call // client.select(3, function() { /* ... */ }); var client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); //clien...
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
test/index-spec.js
JavaScript
import expect from 'expect.js'; describe('index', () => { it('normal', () => { expect(1).be.equal(1); }); });
xiekw2010/wechatlook
0
A koa crawler for wechat look
JavaScript
xiekw2010
David Tse
Alipay
datafeeder.py
Python
import difflib,os import numpy as np import scipy.io.wavfile as wav from tqdm import tqdm from scipy.fftpack import fft from random import shuffle from keras import backend as K from utils import audio from utils.mylogger import log from hparams import hparams as hp import librosa class DataFeeder(): ''' 属性: ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
hparams.py
Python
from tensorflow.contrib.training.python.training.hparam import HParams import os # Default hyperparameters: hparams = HParams( # TODO: audio # num_freq=2048, # 使用librosa默认值 n-fft 256 一般等于窗长(一个窗口有多少个采样点),也就是16000/1000*25ms num_mels=40, # 通常设为 20-40 num_mfccs = 26,#一般至少39啊 # 如果使用快速傅里叶变换(fft)需要保证窗长是...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/ASR_DFCNN.py
Python
import tensorflow as tf from .modules import Conv2dBlockWithMaxPool,post_net from utils.mylogger import log from keras import backend as K from tensorflow.python.ops import ctc_ops as ctc from .base_model import _learning_rate_decay,batch_wer,Base_Model class ASR(Base_Model): def __init__(self,hparams,name='ASR'):...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/ASR_transformer.py
Python
import tensorflow as tf from keras import regularizers from keras.layers import Softmax # noinspection PyPep8Naming from keras import backend as K from utils.mylogger import log from .base_model import Base_Model,_learning_rate_decay from modulesLib.extras import ReusableEmbedding, TiedOutputEmbedding from modulesLib....
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/ASR_transformer2.py
Python
from utils.mylogger import log from .base_model import Base_Model,_learning_rate_decay from .modules import normalize,embedding,multihead_attention,feedforward,label_smoothing import tensorflow as tf class ASR_transformer2(Base_Model): def __init__(self,hparams,name='ASR_transformer2',is_training = True): ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/ASR_transformer_encoder.py
Python
from utils.mylogger import log from .base_model import Base_Model,_learning_rate_decay from .modules import normalize,embedding,multihead_attention,feedforward,label_smoothing import tensorflow as tf class ASR_transformer_encoder(Base_Model): def __init__(self,hparams,name='ASR_transformer_encoder',is_training = ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/ASR_wavnet.py
Python
import tensorflow as tf from .modules import casual_layer,post,res_block,dilated_stack from utils.mylogger import log from keras import backend as K from .base_model import _learning_rate_decay,batch_wer from tensorflow.python.ops import ctc_ops as ctc class ASR_wavnet(object): def __init__(self,hparams,name=None)...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/__init__.py
Python
from .ASR_DFCNN import ASR from .ASR_wavnet import ASR_wavnet from .ASR_transformer2 import ASR_transformer2 from .ASR_transformer_encoder import ASR_transformer_encoder def create_model(name, hparams,is_training =True): if name == 'ASR': return ASR(hparams,name=name) elif name == 'ASR_wavnet': return ASR...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/base_model.py
Python
import tensorflow as tf from keras import backend as K class Base_Model(object): def __init__(self,hparams,name=None): super().__init__() self._hparams = hparams self.name = name def build_graph(self): raise NotImplementedError() def add_loss(self): raise NotImplem...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modules.py
Python
import tensorflow as tf from six.moves import xrange from hparams import hparams ################################ DFCnn ################################################### class Conv2dBlockWithMaxPool(object): """Conv2d Block The output is max_pooled along time. """ def __init__(self,num_conv,activatio...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modulesLib/attention.py
Python
import numpy as np # noinspection PyPep8Naming from keras import backend as K from keras.engine import Layer from keras.utils import get_custom_objects class _BaseMultiHeadAttention(Layer): """ Base class for two types of Multi-head attention layers: Self-attention and its more general form used in decode...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modulesLib/bert.py
Python
""" BERT stands for Bidirectional Encoder Representations from Transformers. It's a way of pre-training Transformer to model a language, described in paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805). A quote from it: > BERT is designed to pre-t...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modulesLib/extras.py
Python
""" Tools that are not necessary for the Transformer by itself, but might be useful in building models with it. """ import math from keras import activations, regularizers # noinspection PyPep8Naming from keras import backend as K from keras.engine import Layer from keras.layers import Embedding from keras.utils impor...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modulesLib/position.py
Python
import numpy as np # noinspection PyPep8Naming from keras import backend as K from keras.engine import Layer from keras.utils import get_custom_objects def positional_signal(d_model: int, length: int, min_timescale: float = 1.0, max_timescale: float = 1e4): """ Helper function, constructi...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
models/modulesLib/transformer.py
Python
""" Contains implementation of the Transformer model described in papers "Attention is all you need" (https://arxiv.org/abs/1706.03762) and "Universal Transformer" (https://arxiv.org/abs/1807.03819) """ import math from typing import Union, Callable, Optional from keras.layers import Layer, Add, activations, Dropout f...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
test.py
Python
import tensorflow as tf import argparse import os,math,copy,shutil from utils.mylogger import * from utils import ValueWindow , plot from hparams import hparams as hp from hparams import hparams_debug_string from datafeeder import DataFeeder,DataFeeder_wavnet from models import create_model import datetime,time import ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
test/serving_client.py
Python
# import tensorflow as tf # import 严重影响速度 import numpy as np # Communication to TensorFlow server via gRPC from grpc.beta import implementations from tensorflow.contrib.util import make_tensor_proto # TensorFlow serving stuff to send messages from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
test/test_am.py
Python
from hparams import hparams as hp from models import create_model from utils.mylogger import * import os import tensorflow as tf import audio,librosa import numpy as np from tensorflow.python import pywrap_tensorflow def compute_mfcc2(file): wav = audio.load_wav(file) # mfcc = p.mfcc(wav,numcep=hp.num_mfccs) ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
train_ASR_DFCNN.py
Python
import tensorflow as tf import argparse import os,math,copy from utils.mylogger import * from utils import ValueWindow , plot from hparams import hparams as hp from hparams import hparams_debug_string from datafeeder import DataFeeder,GetEditDistance from models import create_model import datetime,time import traceback...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
train_ASR_transformer_encoder.py
Python
import tensorflow as tf import argparse import os,math,copy from utils.mylogger import * from utils import ValueWindow , plot from hparams import hparams as hp from hparams import hparams_debug_string from datafeeder import DataFeeder,DataFeeder_wavnet,DataFeeder_transformer from models import create_model import datet...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
train_ASR_wavnet.py
Python
import tensorflow as tf import argparse import os,math,copy,shutil from utils.mylogger import * from utils import ValueWindow , plot from hparams import hparams as hp from hparams import hparams_debug_string from datafeeder import DataFeeder,DataFeeder_wavnet from models import create_model import datetime,time import ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
train_win.py
Python
import tensorflow as tf import argparse import os,math from utils.mylogger import * from utils import ValueWindow , plot from hparams import hparams as hp from datafeeder import DataFeeder,GetEditDistance from models import create_model import datetime,time import traceback,random import numpy as np from keras import b...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
utils/__init__.py
Python
from .mylogger import * from .valuewindow import * class ValueWindow(): def __init__(self, window_size=100): self._window_size = window_size self._values = [] def append(self, x): self._values = self._values[-(self._window_size - 1):] + [x] @property def sum(self): return sum(self._values) ...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
utils/audio.py
Python
import librosa import librosa.filters import numpy as np import tensorflow as tf import scipy from hparams import hparams def load_wav(path): return librosa.core.load(path, sr=hparams.sample_rate)[0] def save_wav(wav, path): wav *= 32767 / max(0.01, np.max(np.abs(wav))) scipy.io.wavfile.write(path, hparams.sa...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
utils/mylogger.py
Python
import logging from termcolor import colored from datetime import datetime import sys # set up logger class _MyFormatter(logging.Formatter): def format(self, record): date = colored('[%(asctime)s @%(filename)s:%(lineno)d]', 'green') msg = '%(message)s' if record.levelno == logging.WARNING:...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
utils/plot.py
Python
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import MultipleLocator def plot_alignment(true_labels, pred_labels, info=None): lens = len(true_labels) matrix = np.zeros(shape=[lens,lens],dtype=np.int32) for j in range(lens): for i in rang...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
utils/valuewindow.py
Python
class ValueWindow(): def __init__(self, window_size=100): self._window_size = window_size self._values = [] def append(self, x): self._values = self._values[-(self._window_size - 1):] + [x] @property def sum(self): return sum(self._values) @property def count(self): return len(self._v...
xingchensong/ASR-Wavnet
5
some ASR-system implementations (via tensorflow 1.x)
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
setup.py
Python
import setuptools PACKAGE_NAME = "cosyvoice_ttsfrd" # Include package data in `setup.cfg` or `setup.py` # setuptools will automatically handle configurations in pyproject.toml, but we need to ensure files are included setuptools.setup( # Ensure specific files in the bundled_files directory are included, but excl...
xingchensong/CosyVoice-ttsfrd
25
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
src/cosyvoice_ttsfrd/__init__.py
Python
__version__ = "0.4.2" import pathlib # Provide a helper function or variable to assist users in finding the decompressed resources. # The resources are expected to be in the parent directory of this file. PACKAGE_ROOT = pathlib.Path(__file__).parent RESOURCE_PATH = PACKAGE_ROOT / "resource" # Assume the decompressed...
xingchensong/CosyVoice-ttsfrd
25
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
src/cosyvoice_ttsfrd/post_install.py
Python
import sys import subprocess import pathlib import zipfile import urllib.request import hashlib def download_with_progress(url, dest_path, expected_sha256=None): print(f"Downloading {url}...") def progress_hook(block_num, block_size, total_size): if total_size > 0: percent = min(100, (blo...
xingchensong/CosyVoice-ttsfrd
25
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/cli.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/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/config.py
Python
import os from dataclasses import dataclass, field import torch from transformers import AutoConfig @dataclass class CosyVoice2LLMConfig: architectures: list[str] = field(default_factory=lambda: ["Qwen2ForCausalLM"]) attention_dropout: float = 0.0 bos_token_id: int = 151643 eos_token_id: int = 6561 ...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/cosyvoice2.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/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/cosyvoice3.py
Python
# TODO(xcsong): Implement CosyVoice3 when it is released
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/engine/block_manager.py
Python
from collections import deque import numpy as np import xxhash from flashcosyvoice.engine.sequence import Sequence class Block: def __init__(self, block_id): self.block_id = block_id self.ref_count = 0 self.hash = -1 self.token_ids = [] def update(self, hash: int, token_ids...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/engine/llm_engine.py
Python
import atexit from dataclasses import fields from time import perf_counter import torch.multiprocessing as mp from tqdm.auto import tqdm from transformers import AutoTokenizer from flashcosyvoice.config import Config, SamplingParams from flashcosyvoice.engine.model_runner import ModelRunner from flashcosyvoice.engine...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/engine/model_runner.py
Python
import pickle from multiprocessing.shared_memory import SharedMemory from multiprocessing.synchronize import Event import torch import torch.distributed as dist from flashcosyvoice.config import Config from flashcosyvoice.engine.sequence import Sequence from flashcosyvoice.modules.qwen2 import Qwen2ForCausalLM from f...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/engine/scheduler.py
Python
from collections import deque from flashcosyvoice.config import Config from flashcosyvoice.engine.block_manager import BlockManager from flashcosyvoice.engine.sequence import Sequence, SequenceStatus class Scheduler: def __init__(self, config: Config): self.max_num_seqs = config.max_num_seqs sel...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/engine/sequence.py
Python
from copy import copy from enum import Enum, auto from itertools import count from flashcosyvoice.config import SamplingParams class SequenceStatus(Enum): WAITING = auto() RUNNING = auto() FINISHED = auto() class Sequence: block_size = 256 counter = count() def __init__(self, token_ids: li...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/flow.py
Python
from dataclasses import dataclass import torch import torch.nn as nn import torch.nn.functional as F from flashcosyvoice.modules.flow_components.estimator import \ CausalConditionalDecoder from flashcosyvoice.modules.flow_components.upsample_encoder import ( UpsampleConformerEncoder, make_pad_mask) # TODO(x...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/flow_components/estimator.py
Python
import math from typing import Any, Dict, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from diffusers.models.attention import (GEGLU, GELU, AdaLayerNorm, AdaLayerNormZero, ApproximateGELU) from diffusers.models.attention_processor import Att...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/flow_components/upsample_encoder.py
Python
import math from typing import Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F def subsequent_chunk_mask( size: int, chunk_size: int, num_left_chunks: int = -1, device: torch.device = torch.device("cpu"), ) -> torch.Tensor: """Create mask ...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/hifigan.py
Python
# Copyright (c) 2024 Alibaba Inc (authors: Xiang Lyu, Kai Hu) # # 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 applica...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/hifigan_components/layers.py
Python
from typing import List import numpy as np import torch import torch.nn as nn from torch.distributions.uniform import Uniform from torch.nn import Conv1d from torch.nn.utils import remove_weight_norm try: from torch.nn.utils.parametrizations import weight_norm except ImportError: from torch.nn.utils import we...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/qwen2.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/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/qwen2_components/layers.py
Python
from functools import lru_cache import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import triton import triton.language as tl from flash_attn import flash_attn_varlen_func, flash_attn_with_kvcache from flashcosyvoice.config import CosyVoice2LLMConfig from flashcosyvoic...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/modules/sampler.py
Python
import torch from torch import nn class Sampler(nn.Module): """ Optimized sampler implementation using vectorized operations instead of loops, significantly improving performance Performance optimizations: 1. Using batch processing instead of sequence loops, reducing Python loop overhead 2. Using...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/utils/audio.py
Python
import numpy as np import torch from librosa.filters import mel as librosa_mel_fn from scipy.io.wavfile import read MAX_WAV_VALUE = 32768.0 def load_wav(full_path): sampling_rate, data = read(full_path) return data, sampling_rate def dynamic_range_compression(x, C=1, clip_val=1e-5): return np.log(np.cl...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/utils/context.py
Python
from dataclasses import dataclass import torch @dataclass class Context: is_prefill: bool = False cu_seqlens_q: torch.Tensor | None = None cu_seqlens_k: torch.Tensor | None = None max_seqlen_q: int = 0 max_seqlen_k: int = 0 slot_mapping: torch.Tensor | None = None context_lens: torch.Tens...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/utils/loader.py
Python
import os from glob import glob import torch from safetensors import safe_open from torch import nn from flashcosyvoice.config import CosyVoice2LLMConfig def default_weight_loader(param: nn.Parameter, loaded_weight: torch.Tensor): param.data.copy_(loaded_weight) def load_text_llm(model: nn.Module, path: str):...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
flashcosyvoice/utils/memory.py
Python
import os import torch from pynvml import * # noqa def get_gpu_memory(): torch.cuda.synchronize() nvmlInit() visible_device = list(map(int, os.getenv("CUDA_VISIBLE_DEVICES", "0,1,2,3,4,5,6,7").split(','))) cuda_device_idx = torch.cuda.current_device() cuda_device_idx = visible_device[cuda_device...
xingchensong/FlashCosyVoice
242
FlashCosyVoice: A lightweight vLLM implementation built from scratch for CosyVoice.
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/__init__.py
Python
# Copyright (c) 2023 OpenAI. (authors: Whisper Team) # 2024 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...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/cli.py
Python
# Copyright (c) 2024 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/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/model.py
Python
# Copyright (c) 2023 OpenAI. (authors: Whisper Team) # 2024 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...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/model_v2.py
Python
# Copyright (c) (Mddct: Dinghao Zhou) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/model_v3.py
Python
# Copyright (c) (Mddct: Dinghao Zhou) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
s3tokenizer/utils.py
Python
# Copyright (c) 2023 OpenAI. (authors: Whisper Team) # 2024 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...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
setup.py
Python
from pathlib import Path from setuptools import find_packages, setup def parse_requirements(filename): """Load requirements from a pip requirements file.""" with open(filename, 'r') as file: lines = (line.strip() for line in file) return [line for line in lines if line and not line.startswith...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
test/test_batch_efficiency.py
Python
#!/usr/bin/env python3 """ Batch processing efficiency test Test the efficiency improvement of new batch processing functionality for mixed long and short audio """ import time import pytest import s3tokenizer import torch def create_test_audio(duration_seconds=20, sample_rate=16000): """Create test audio""" ...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
test/test_onnx.py
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright [2024-09-27] <sxc19@mails.tsinghua.edu.cn, Xingchen Song> import os import time from typing import Any, Dict import numpy as np import onnxruntime import pytest import s3tokenizer import torch def create_test_audio(duration_seconds: float = 20, ...
xingchensong/S3Tokenizer
505
Reverse Engineering of Supervised Semantic Speech Tokenizer (S3Tokenizer) proposed in CosyVoice
Python
xingchensong
Xingchen Song(宋星辰)
Tsinghua University (2019-2022), WeNet Community (2021-now)
examples/audio/pretrain/emilia/path.sh
Shell
cuda_prefix=/usr/local cache_prefix=/mnt/user-ssd/songxingchen/share . ./parse_options.sh || exit 1; if [ ! -d "${cuda_prefix}/cuda" ]; then echo "Error: CUDA_HOME directory does not exist: ${cuda_prefix}/cuda" exit 1 fi if [ ! -d "${cache_prefix}" ]; then echo "Error: cache_prefix directory does not exis...
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)
examples/audio/pretrain/wenetspeech/parse_options.sh
Shell
#!/bin/bash # Copyright 2012 Johns Hopkins University (Author: Daniel Povey); # Arnab Ghoshal, Karel Vesely # 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.ap...
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)
examples/audio/pretrain/wenetspeech/path.sh
Shell
cuda_prefix=/usr/local cache_prefix=/mnt/user-ssd/songxingchen/share . ./parse_options.sh || exit 1; if [ ! -d "${cuda_prefix}/cuda" ]; then echo "Error: CUDA_HOME directory does not exist: ${cuda_prefix}/cuda" exit 1 fi if [ ! -d "${cache_prefix}" ]; then echo "Error: cache_prefix directory does not exis...
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)
examples/audio/pretrain/wenetspeech/run.sh
Shell
#!/bin/bash # NOTE(xcsong): change xx_prefix and xx_version to ur setup cache_prefix=/mnt/user-ssd/songxingchen/share cuda_prefix=/usr/local pretrained_weight_dir="" # for fromscratch training # pretrained_weight_dir="/mnt/user-ssd/songxingchen/share/modelscope/Llama-3.2-1B-Instruct" # for continue pretrain pretrain...
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)
examples/audio/sft/asr/wenetspeech/local/extract_trans_and_pred.py
Python
import argparse import json import os from tqdm import tqdm def main(jsonl_path): out_dir = os.path.dirname(jsonl_path) trans_path = os.path.join(out_dir, 'trans.txt') raw_rec_path = os.path.join(out_dir, 'raw_rec.txt') with open(jsonl_path, 'r', encoding='utf-8') as fin, \ open(trans_path,...
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)
examples/audio/sft/asr/wenetspeech/parse_options.sh
Shell
#!/bin/bash # Copyright 2012 Johns Hopkins University (Author: Daniel Povey); # Arnab Ghoshal, Karel Vesely # 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.ap...
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)
examples/audio/sft/asr/wenetspeech/path.sh
Shell
cuda_prefix=/usr/local cache_prefix=/mnt/user-ssd/songxingchen/share . ./parse_options.sh || exit 1; if [ ! -d "${cuda_prefix}/cuda" ]; then echo "Error: CUDA_HOME directory does not exist: ${cuda_prefix}/cuda" exit 1 fi if [ ! -d "${cache_prefix}" ]; then echo "Error: cache_prefix directory does not exis...
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)
examples/audio/sft/asr/wenetspeech/run.sh
Shell
#!/bin/bash # NOTE(xcsong): change xx_prefix and xx_version to ur setup cache_prefix=/mnt/user-ssd/songxingchen/share cuda_prefix=/usr/local # NOTE(xcsong): Qwen2-Audio-7B https://modelscope.cn/models/Qwen/Qwen2-Audio-7B # pretrained_weight_dir="${cache_prefix}/modelscope/Qwen2-Audio-7B" # for fintuning pretrained_...
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)
examples/text/pretrain/allenai_c4/download_c4.py
Python
import os from datasets import DownloadConfig, load_dataset hf_data_repo = "allenai/c4" hf_data_name = "en" download_config = DownloadConfig( num_proc=12, max_retries=1200, ) # English only signal = 1 while signal: try: # 305GB, 156B tokens # ref: https://mp.weixin.qq.com/s?__biz=MjM5ODE...
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)
examples/text/pretrain/allenai_c4/parse_options.sh
Shell
#!/bin/bash # Copyright 2012 Johns Hopkins University (Author: Daniel Povey); # Arnab Ghoshal, Karel Vesely # 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.ap...
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)
examples/text/pretrain/allenai_c4/path.sh
Shell
cuda_prefix=/usr/local cache_prefix=/mnt/user-ssd/songxingchen/share . ./parse_options.sh || exit 1; if [ ! -d "${cuda_prefix}/cuda" ]; then echo "Error: CUDA_HOME directory does not exist: ${cuda_prefix}/cuda" exit 1 fi if [ ! -d "${cache_prefix}" ]; then echo "Error: cache_prefix directory does not exis...
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)
examples/text/pretrain/allenai_c4/run.sh
Shell
#!/bin/bash # NOTE(xcsong): change xx_prefix and xx_version to ur setup cache_prefix=/mnt/user-ssd/songxingchen/share cuda_prefix=/usr/local pretrained_weight_dir="" # for fromscratch training # pretrained_weight_dir="/bucket/output/jfs-hdfs/user/xingchen.song/share/modelscope/Llama-3.2-1B-Instruct" # for continue 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)
examples/text/pretrain/fineweb-edu/download_fineweb-edu.py
Python
import os from datasets import DownloadConfig, load_dataset hf_data_repo = "HuggingFaceFW/fineweb-edu" hf_data_name = "default" download_config = DownloadConfig( num_proc=12, max_retries=1200, ) # English only signal = 1 while signal: try: # 9.74TB, 1.3T tokens data = load_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)
examples/text/pretrain/fineweb-edu/parse_options.sh
Shell
#!/bin/bash # Copyright 2012 Johns Hopkins University (Author: Daniel Povey); # Arnab Ghoshal, Karel Vesely # 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.ap...
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)
examples/text/pretrain/fineweb-edu/path.sh
Shell
cuda_prefix=/usr/local cache_prefix=/mnt/user-ssd/songxingchen/share . ./parse_options.sh || exit 1; if [ ! -d "${cuda_prefix}/cuda" ]; then echo "Error: CUDA_HOME directory does not exist: ${cuda_prefix}/cuda" exit 1 fi if [ ! -d "${cache_prefix}" ]; then echo "Error: cache_prefix directory does not exis...
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)
examples/text/pretrain/fineweb-edu/run.sh
Shell
#!/bin/bash # NOTE(xcsong): change xx_prefix and xx_version to ur setup cache_prefix=/mnt/user-ssd/songxingchen/share cuda_prefix=/usr/local pretrained_weight_dir="" # for fromscratch training # pretrained_weight_dir="/bucket/output/jfs-hdfs/user/xingchen.song/share/modelscope/Llama-3.2-1B-Instruct" # for continue 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)
install_cuda_cudnn.sh
Shell
#!/bin/bash # Copyright [2024-04-09] <sxc19@mails.tsinghua.edu.cn, Xingchen Song> cuda_version=12.6.3 driver_version=560.35.05 cudnn_version=9.5.1.17 prefix=/bucket/output/jfs-hdfs/user/xingchen.song/tools/cuda echo "start download cuda ${cuda_version} & cudnn ${cudnn_version}" wget https://developer.download.nvidia....
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)
tests/touchnet/bin/test_make_data.py
Python
import json import subprocess import pytest import torch import torchaudio from touchnet.data import DataConfig from touchnet.data.datapipe import LowLevelTouchDatapipe @pytest.fixture def run_shell(): def _run(cmd, check=True): return subprocess.run( cmd, shell=True, ...
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)
tests/touchnet/data/test_dataloader.py
Python
import os import numpy import pytest import torch from touchnet.bin.make_data import DataBuilder from touchnet.data import DataConfig from touchnet.data.dataloader import ParallelAwareDataloader from touchnet.data.datapipe import LowLevelTouchDatapipe def build_fake_data(nnodes, nproc_per_node, max_epoch): tota...
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)
tests/touchnet/models/test_llama.py
Python
import os import subprocess from multiprocessing import Manager import pytest import torch import torch.distributed.checkpoint as dcp from torch import distributed as dist from transformers import AutoConfig, AutoModelForCausalLM from touchnet.bin import TrainConfig from touchnet.utils.distributed import ParallelDims...
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)
tests/touchnet/utils/distributed_cpu.py
Python
import os import torch from transformers.hf_argparser import HfArgumentParser from touchnet.bin import TrainConfig from touchnet.utils.distributed import ParallelDims from touchnet.utils.logging import init_logger init_logger() parser = HfArgumentParser(TrainConfig) job_config = parser.parse_args_into_dataclasses()...
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)
tests/touchnet/utils/test_distributed_cpu.py
Python
import subprocess import time import pytest def is_port_open(host, port): import socket with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.settimeout(2) return s.connect_ex((host, port)) == 0 # @pytest.mark.parametrize("master_port, nnodes, nproc_per_node, dp_shard, dp_replicate...
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)
tests/touchnet/utils/test_pack_loss.py
Python
from multiprocessing import Manager import pytest import torch import torch.nn as nn from torch import distributed as dist from torch.distributed.nn.functional import all_gather def calc_batch_dp_loss(batch_input_ids=None, batch_labels=None): """ Calculate loss using data parallelism (batch splitting). ...
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)