Skip to main content

ML/DL tools function library

Project description


image image image image

Universal function library of scientific calculation.


Python 3
CUDA >= 10.0
PyTorch >= 1.0
Tensorflow >= 1.12.0


# Before install `guang`, you should have installed all the requirements.
pip install guang

Nightly Build

git clone
cd guang
python ./


  • Convert audio in .mp3/ .wav format to (sample rate=16k, single channel) .wav format

    Use on bash

    guang cvt2wav INPUT OUTPUT

    Use as function

    from guang.Voice.convert import cvt2wav
    cvt2wav(input_name, output_name, sr=16000)
    # Multi-process
    from guang.Voice.convert import multi_cvt2wav 
    multi_cvt2wav(PATH1, PATH2,sr=16000, n_cpu=None)
  • Let the video play at N times speed (install ffmpeg first)

    guang av_speed inputname outputname N --cut_frame=False
  • Fourier visualization

    guang fourier
  • FFT convolution

    from guang.sci import fft
    A = np.random.rand(100, 100)
    B = np.random.rand(100, 100)
    fft.fft_conv2d(A, B)
  • Use dict_dotable to convert a dictionary to dot-able dictionary:

    from guang.Utils.toolsFunc import dict_dotable
    a = {'a':{'b':1}}
    a = dict_dotable(a)
    >> 1
  • Use probar to display current progress has separated to pyprobar

    from import bar, probar
    for idx, x in probar(range(10)):
    >> 100.00% |█████████████████████████████| 0'7.2"|0'7.2" ETC: 12-2 23:59:8
    N = 1024
    a = np.linspace(2, 5, N)
    for idx, i in enumerate(a):
        bar(idx, N)
    >> 100.00% |█████████████████████████████| 0:00:00|0:00:10  ETC: 02-19 20:33:34 
  • @broadcast broadcast a non-broadcast function.

    from guang.Utils.toolsFunc import broadcast
    def f(x):
        # A function that can map only a single element
        if x==1 or x==0:
            return x
            return f(x-1)+f(x-2)
    >> f([2,4,10])
    >> array([1, 3, 832040], dtype=object)
  • download download files from google drive.

    from import download
    url = ""
    outname = ""
    download(url, outname)
  • txt2ph Convert Chinese characters to phoneme.

    from guang.Voice.txt2pinyin import txt2ph
    >> [('n', 'i3'), ('h', 'ao3'), ('sp1',), ('uo3',), ('sh', 'ii4'), ('g', 'uang1')]
  • reduce_from_duration Remove files with duration less than least_time seconds. Note that this function does not work in the interactive interpreter because it uses multiprocessing.pool.Pool

    from guang.Voice.reduce import reduce_from_duration
    reduced_list = reduce_from_duration(path_list, least_time=2)
    print(len(path_list), len(reduced_list))
    >> (6889, 6714)
  • Find NOT silence part of a sound file: find_no_silence

    from guang.Voice.reduce import find_no_silence
    start, end, arg_start, arg_end = find_no_silence(filename)
  • Download wechat files.

    from import downloads
    downloads(nickName='caloi', fileType='mp3', d_t=60)
  • Plots 3D Scatter:

    from guang.Utils.plotly import Scatter3d
    from guang.Utils.interesting import Lorenz
    trace = Lorenz.Trace()
    x,y,z = trace[:,0], trace[:,1], trace[:,2]
    fig = Scatter3d()
  • Data dimension reduction:

    cd guang/ML/manifold
    python test_s_curve
  • :smiley:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for guang, version
Filename, size File type Python version Upload date Hashes
Filename, size guang- (99.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size guang- (68.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page