repo_full_name
stringlengths
6
93
repo_url
stringlengths
25
112
repo_api_url
stringclasses
28 values
owner
stringclasses
28 values
repo_name
stringclasses
28 values
description
stringclasses
28 values
stars
int64
617
98.8k
forks
int64
31
355
watchers
int64
990
999
license
stringclasses
2 values
default_branch
stringclasses
2 values
repo_created_at
timestamp[s]date
2012-07-24 23:12:50
2025-06-16 08:07:28
repo_updated_at
timestamp[s]date
2026-02-23 15:23:15
2026-05-03 18:52:12
repo_topics
listlengths
0
13
repo_languages
unknown
is_fork
bool
1 class
open_issues
int64
3
104
file_path
stringlengths
3
208
file_name
stringclasses
509 values
file_extension
stringclasses
1 value
file_size_bytes
int64
101
84k
file_url
stringclasses
627 values
file_raw_url
stringclasses
627 values
file_sha
stringclasses
624 values
language
stringclasses
8 values
parsed_at
stringdate
2026-05-04 01:12:36
2026-05-04 19:41:55
text
stringlengths
100
102k
stravalib/stravalib
https://github.com/stravalib/stravalib
null
null
null
null
980
null
null
apache-2.0
null
null
null
null
null
null
null
src/stravalib/tests/unit/test_validate_activity_type.py
null
null
null
null
null
null
Python
2026-05-04T02:34:28.720126
import pytest @pytest.fixture def params(): """A fixture that creates a dictionary representing parameters associated with a Strava activity.""" params = { "name": "New Activity", "start_date_local": "2024-03-04T18:56:47Z", "elapsed_time": 9000, "description": "An activity...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/CEEMDAN.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.245236
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Feel free to contact for any information. """ .. currentmodule:: CEEMDAN """ import logging import os from multiprocessing import Pool from typing import Dict, List, Optional, Sequence, Tuple, Union...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/checks.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.246828
"""Calculate the statistical Significance of IMFs.""" import logging import math import numpy as np from scipy import stats from scipy.signal import find_peaks # helper function: Find mean period of an IMF def mean_period(data): """Return mean-period of signal.""" peaks = len(find_peaks(data, height=0)[0]) ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/BEMD.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.249569
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Feel free to contact for any information. import logging import numpy as np from scipy.interpolate import Rbf try: from skimage.morphology import reconstruction except (ImportError, ModuleNotF...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/EEMD.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.365108
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Feel free to contact for any information. """ .. currentmodule:: EEMD """ import logging import os from collections import defaultdict from multiprocessing import Pool from typing import Dict, List,...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.367209
import logging __version__ = "1.9.0" logger = logging.getLogger("pyemd") from PyEMD.CEEMDAN import CEEMDAN # noqa from PyEMD.EEMD import EEMD # noqa from PyEMD.EMD import EMD # noqa from PyEMD.visualisation import Visualisation # noqa
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/EMD2d.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.369727
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Edited: 07/07/2017 # # Feel free to contact for any information. import logging import numpy as np try: from scipy.interpolate import SmoothBivariateSpline as SBS from scipy.ndimage.filt...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/compact.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.371166
import numpy as np def TDMAsolver(a, b, c, d): """Thomas algorithm to solve tridiagonal linear systems with non-periodic BC. | b0 c0 | | . | | . | | a1 b1 c1 | | . | | . | | a2 b2 c2 | | x | = | d | | .......... | | . | | ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/EMD.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.372231
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Feel free to contact for any information. import logging from typing import Optional, Tuple import numpy as np from scipy.interpolate import interp1d from PyEMD.splines import akima,...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/EMD_matlab.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.373264
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Contact: https://github.com/laszukdawid/PyEMD/issues # # Edited: 11/05/2017 # # Feel free to contact for any information. import logging import time import numpy as np from scipy.interpolate import interp1d from PyEMD.splines import ak...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/experimental/jitemd.py
null
null
null
null
null
null
Python
2026-05-04T02:34:31.962517
#!/usr/bin/python # coding: UTF-8 # # Author: Dawid Laszuk # Issues: https://github.com/laszukdawid/PyEMD/issues """ Uses Numba (https://numba.pydata.org/) as a Just-in-Time (JIT) compiler for Python, mostly Numpy. Just-in-time compilation means that the code is compiled (machine code) during execution, and ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/splines.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.395199
import numpy as np from scipy.interpolate import Akima1DInterpolator, CubicHermiteSpline, CubicSpline, PchipInterpolator def cubic_spline_3pts(x, y, T): """ Apparently scipy.interpolate.interp1d does not support cubic spline for less than 4 points. """ x0, x1, x2 = x y0, y1, y2 = y ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_checks.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.396665
"""Tests for checks.py.""" import unittest import numpy as np from PyEMD.checks import energy, mean_period, significance_aposteriori, significance_apriori, whitenoise_check class TestCase(unittest.TestCase): """Test cases.""" def test_mean_period(self): """Test to check if mean period output is co...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_eemd.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.402599
import unittest import numpy as np from PyEMD import EEMD class EEMDTest(unittest.TestCase): @staticmethod def cmp_msg(a, b): return "Expected {}, Returned {}".format(a, b) @staticmethod def test_default_call_EEMD(): T = np.arange(50) S = np.cos(T * 0.1) max_imf = 2 ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_emd.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.406338
import unittest import numpy as np from PyEMD import EMD class EMDTest(unittest.TestCase): @staticmethod def test_default_call_EMD(): T = np.arange(50) S = np.cos(T * 0.1) max_imf = 2 emd = EMD() emd(S, T, max_imf) def test_different_length_input(self): ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_bemd.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.409920
#!/usr/bin/python # Coding: UTF-8 import unittest import numpy as np try: from PyEMD.BEMD import BEMD except (ImportError, ModuleNotFoundError): # Not supported until supported. pass @unittest.skip("Not supported until supported") class BEMDTest(unittest.TestCase): def setUp(self) -> ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_ceemdan.py
null
null
null
null
null
null
Python
2026-05-04T02:34:32.411293
import unittest import numpy as np from PyEMD import CEEMDAN class CEEMDANTest(unittest.TestCase): @staticmethod def cmp_msg(a, b): return "Expected {}, Returned {}".format(a, b) @staticmethod def test_default_call_CEEMDAN(): T = np.arange(50) S = np.cos(T * 0.1) max...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_all.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.454839
import sys import unittest if __name__ == "__main__": test_suite = unittest.defaultTestLoader.discover(".", "*test*.py") test_runner = unittest.TextTestRunner(resultclass=unittest.TextTestResult) result = test_runner.run(test_suite) sys.exit(not result.wasSuccessful())
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_compact.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.607799
#!/usr/bin/python # Coding: UTF-8 import unittest import numpy as np import scipy as sp from PyEMD.compact import * class CompactTest(unittest.TestCase): @staticmethod def create_signal(): # Do NOT modify this function! If you do, the following can happen: # -- Possible test errors for filt...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_emd2d.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.638953
#!/usr/bin/python # Coding: UTF-8 import unittest import numpy as np from PyEMD.EMD2d import EMD2D @unittest.skip("Not supported until supported") class ImageEMDTest(unittest.TestCase): def setUp(self) -> None: self.emd2d = EMD2D() @staticmethod def _generate_image(r=64, c=64): return ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_emd_matlab.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.790882
import unittest import numpy as np from PyEMD.EMD_matlab import EMD class EMDMatlabTest(unittest.TestCase): @staticmethod def test_default_call_EMD(): T = np.arange(0, 1, 0.01) S = np.cos(2 * T * 2 * np.pi) max_imf = 2 emd = EMD() emd.emd(emd, S, T, max_imf) def...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_utils.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.798926
import unittest import numpy as np from PyEMD.utils import deduce_common_type, get_timeline, unify_types class MyTestCase(unittest.TestCase): def test_get_timeline_default_dtype(self): S = np.random.random(100) T = get_timeline(len(S)) self.assertEqual(len(T), len(S), "Lengths must be e...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_extrema.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.813932
#!/usr/bin/python # Coding: UTF-8 import unittest import numpy as np from PyEMD import EMD class ExtremaTest(unittest.TestCase): def test_incorrectExtremaDetectionSetup(self): extrema_detection = "bubble_gum" # Sanity check emd = EMD() self.assertFalse(emd.extrema_detection == ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_splines.py
null
null
null
null
null
null
Python
2026-05-04T02:34:33.843452
#!/usr/bin/python # Coding: UTF-8 import unittest import numpy as np from PyEMD import EMD from PyEMD.splines import * class IMFTest(unittest.TestCase): """ Since these tests depend heavily on NumPy & SciPy, make sure you have NumPy >= 1.12 and SciPy >= 0.19. """ def test_unsu...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/visualisation.py
null
null
null
null
null
null
Python
2026-05-04T02:34:34.040144
import numpy as np from scipy.signal import hilbert from PyEMD.compact import filt6, pade6 # Visualisation is an optional module. To minimise installation, `matplotlib` is not added # by default. Please install extras with `pip install -r requirement-extra.txt`. try: import pylab as plt except ImportError: pa...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/eemd_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.039087
# Author: Dawid Laszuk # Last update: 7/07/2017 from PyEMD import EEMD import numpy as np import pylab as plt # Define signal t = np.linspace(0, 1, 200) sin = lambda x, p: np.sin(2 * np.pi * x * t + p) S = 3 * sin(18, 0.2) * (t - 0.2) ** 2 S += 5 * sin(11, 2.7) S += 3 * sin(14, 1.6) S += 1 * np.sin(4 * 2 * np.pi * (t...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/jit_emd_class_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.106455
import numpy as np from PyEMD.experimental.jitemd import JitEMD, get_timeline rng = np.random.RandomState(4132) s = rng.random(500) t = get_timeline(len(s), s.dtype) emd = JitEMD(spline_kind="akima") imfs = emd(s, t) print(imfs) print(imfs.shape)
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/emd_comparison.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.140169
""" This example shows very high numbers for JIT because on import the JitEMD is compiled making it very efficient. It takes a good 20+ seconds to compile which is hidden. For this reason, JitEMD is worthy when iterating on live notebook or performing a lot of the same computation within a single execution. For a sing...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/example_spline_capabilities.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.141443
#!/usr/bin/env python3 # Coding: UTF-8 import numpy as np import matplotlib.pyplot as plt from PyEMD import EMD from PyEMD.splines import * from PyEMD.utils import get_timeline def test_spline(X, T, s_kind): """ Test the fitting with the given spline. Parameters ---------- X ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/hht_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.239843
import numpy as np import pylab as plt from scipy.signal import hilbert from PyEMD import EMD def instant_phase(imfs): """Extract analytical signal through Hilbert Transform.""" analytic_signal = hilbert(imfs) # Apply Hilbert transform to each row phase = np.unwrap(np.angle(analytic_signal)) # Compute ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/jit_emd_function_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.614541
import copy import numpy as np from PyEMD.experimental.jitemd import emd, default_emd_config from PyEMD.experimental.jitemd import get_timeline rng = np.random.RandomState(4132) s = rng.random(500) t = get_timeline(len(s), s.dtype) config = copy.copy(default_emd_config) config["FIXE"] = 5 imfs = emd(s, t, spline_kin...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/simple_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.705999
# Author: Dawid Laszuk # Last update: 7/07/2017 import numpy as np import pylab as plt from PyEMD import EMD # Define signal t = np.linspace(0, 1, 200) s = np.cos(11 * 2 * np.pi * t * t) + 6 * t * t # Execute EMD on signal IMF = EMD().emd(s, t) N = IMF.shape[0] + 1 # Plot results plt.subplot(N, 1, 1) plt.plot(t, s, ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/image_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.726667
# Author: Dawid Laszuk # Last update: 7/07/2017 import numpy as np import pylab as plt from PyEMD import EMD2D # Generate image print("Generating image... ", end="") rows, cols = 1024, 1024 row_scale, col_scale = 256, 256 x = np.arange(rows) / float(row_scale) y = np.arange(cols).reshape((-1, 1)) / float(col_scale) p...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
perf_test/compare_results.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.744744
#!/usr/bin/env python """ Compare two PyEMD performance test results. Usage: python compare_results.py <baseline> <comparison> python compare_results.py results/20241201_120000_full results/20241202_120000_full Options: --threshold PERCENT Highlight changes greater than this percentage (default: 5) -...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
noxfile.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.817892
import nox # Use uv for faster dependency installation and Python version management nox.options.default_venv_backend = "uv" # Test against all currently supported Python versions (3.10+) PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] @nox.session(python=PYTHON_VERSIONS) def tests(session: nox.Session) -...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
perf_test/perf_test.py
null
null
null
null
null
null
Python
2026-05-04T02:34:35.829028
import numpy as np from PyEMD import EMD def test_prepare_points_simple(benchmark): emd = EMD() T_max = 50 T = np.linspace(0, T_max, 10000) S = np.sin(T * 2 * np.pi) # max_pos = np.array([0.25, 1.25, 2.25, 3.25], dtype=np.float32) max_pos = np.arange(T_max - 1, dtype=np.float32) + 0.25 ma...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
perf_test/perf_test_comprehensive.py
null
null
null
null
null
null
Python
2026-05-04T02:34:37.279461
""" Comprehensive Performance Test Suite for PyEMD This module tests various performance aspects of the EMD library: 1. EMD scaling with signal length 2. EMD with different spline methods 3. EMD with different extrema detection methods 4. EEMD parallel scaling 5. CEEMDAN performance characteristics Run with: .venv/bi...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
perf_test/perf_test_jitemd.py
null
null
null
null
null
null
Python
2026-05-04T02:34:37.936253
""" Performance Test Suite for JIT-compiled EMD (jitemd.py) This module tests various performance aspects of the JIT EMD implementation: 1. JIT compilation warmup overhead 2. JitEMD scaling with signal length 3. JitEMD vs standard EMD comparison 4. JitEMD with different spline methods 5. JitEMD with different extrema ...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/tests/test_visualization.py
null
null
null
null
null
null
Python
2026-05-04T02:34:38.045042
import unittest import numpy as np from PyEMD import EMD from PyEMD.visualisation import Visualisation class VisTest(unittest.TestCase): def test_instantiation(self): emd = EMD() with self.assertRaises(ValueError): Visualisation(emd) def test_instantiation2(self): t = np...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/types.py
null
null
null
null
null
null
Python
2026-05-04T02:34:38.050833
from typing import Union import numpy as np EmdArray = np.ndarray EmdDType = np.dtype try: import torch EmdArray = Union[np.ndarray, torch.Tensor] EmdDType = Union[np.dtype, torch.dtype] except ImportError: pass
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
PyEMD/utils.py
null
null
null
null
null
null
Python
2026-05-04T02:34:38.065811
import sys from typing import Optional, Tuple import numpy as np if sys.version_info >= (3, 9): from functools import cache else: from functools import lru_cache as cache def get_timeline(range_max: int, dtype: Optional[np.dtype] = None) -> np.ndarray: """Returns timeline array for requirements. Pa...
laszukdawid/PyEMD
https://github.com/laszukdawid/PyEMD
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
example/jit_eemd_example.py
null
null
null
null
null
null
Python
2026-05-04T02:34:39.931924
import numpy as np from PyEMD import EEMD from PyEMD.experimental.jitemd import JitEMD, get_timeline s = np.random.random(100) t = get_timeline(len(s), s.dtype) emd = JitEMD() eemd = EEMD(ext_EMD=emd) imfs = eemd(s, t) print(imfs) print(imfs.shape)
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/gradio_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.120472
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: pip install gradio """ import sys import gradio as gr sys.path.append('../..') from textgen import T5Model # 中文对联生成模型(shibing624/t5-chinese-couplet) model = T5Model("t5", "shibing624/t5-chinese-couplet") def ai_text(sentence): out_senten...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/t5_prompt_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.124384
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen import T5Model if __name__ == '__main__': model = T5Model('t5', 'shibing624/prompt-t5-base-chinese', args={"eval_batch_size": 64}) sentences = [ "阅读下列对话。_女:小李,听说你的毕业设计主题是环保?男...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/t5pegasus.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.146760
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: 中文句子续写 refer https://github.com/renmada/t5-pegasus-pytorch 原文:蓝蓝的天上有一朵白白的云 torch预测 《蓝蓝的天上有一朵白白的云》是蓝蓝的天上有一朵白白的云创作的网络小说,发表于... """ import sys from transformers.models.mt5 import MT5ForConditionalGeneration sys.path.append('../..') from tex...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/training_byt5_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.151440
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse from loguru import logger import pandas as pd import os import sys sys.path.append('../..') from textgen.t5 import T5Model def load_data(prefix, file_path): data = [] with open(file_path, 'r', encoding='utf-8') as ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/training_zh_prompt_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.158065
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: 下载pCLUE的部分数据(如,pCLUE_train_1.json)到本地 wget https://raw.githubusercontent.com/CLUEbenchmark/pCLUE/main/datasets/pCLUE_train_1.json wget https://raw.githubusercontent.com/CLUEbenchmark/pCLUE/main/datasets/pCLUE_train_2.json wget https://raw.githu...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/t5_xlsum.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.165308
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: mT5多语言文本摘要模型 refer https://huggingface.co/csebuetnlp/mT5_multilingual_XLSum """ import re from transformers import AutoTokenizer, AutoModelForSeq2SeqLM model_name = "csebuetnlp/mT5_multilingual_XLSum" tokenizer = AutoTokenizer.from_pretrained(m...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/t5_couplet_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.166320
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.t5 import T5Model if __name__ == '__main__': model = T5Model('t5', 'shibing624/t5-chinese-couplet', args={"eval_batch_size": 64}) sentences = ["对联:丹枫江冷人初去", "对联:春回大地,对对黄莺鸣暖树", "对联:书香...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/training_zh_t5_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.169450
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse from loguru import logger import pandas as pd import time import os import sys sys.path.append('../..') from textgen.t5 import T5Model def load_data(prefix, file_path): data = [] with open(file_path, 'r', encoding=...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/T5/training_copyt5_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.169956
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse from loguru import logger import time import pandas as pd import os import sys sys.path.append('../..') from textgen import CopyT5Model def load_data(prefix, file_path): data = [] with open(file_path, 'r', encoding...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt/gradio_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:42.174004
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: pip install gradio>=3.50.2 """ import argparse from threading import Thread import gradio as gr import torch from transformers import TextIteratorStreamer from textgen import GptModel, get_conv_template def main(): parser = argparse.Arg...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt/inference_multigpu_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.053169
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: use torchrun to inference with multi-gpus usage: CUDA_VISIBLE_DEVICES=0,1 torchrun --nproc_per_node 2 inference_multigpu_demo.py --model_type bloom --base_model bigscience/bloom-560m """ import argparse import json import os import sys import ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt/training_llama_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.067528
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import sys from loguru import logger sys.path.append('../..') from textgen import GptModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--train_file', default='../data/sharegpt_zh_100_forma...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt2/training_couplet_gpt2_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.069408
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: 使用GPT2模型做对联生成任务,prompt为上联,自动对下联 本示例自定义了GPT2模型的Dataset,使其完成类似seq2seq的生成任务,可以适配对话生成、对联生成、诗歌生成等任务 """ from loguru import logger import argparse from transformers import BertTokenizerFast import torch from torch.utils.data import Dataset import os ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt/inference_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.072646
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: use deepspeed to inference with multi-gpus usage: CUDA_VISIBLE_DEVICES=0 python inference_demo.py --model_type baichuan --base_model shibing624/vicuna-baichuan-13b-chat --interactive """ import argparse import json import sys sys.path.append('...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt/training_chatglm_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.073199
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import sys from loguru import logger sys.path.append('../..') from textgen import GptModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--train_file', default='../data/sharegpt_zh_100_format...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt2/training_zh_gpt2_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.074920
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os from loguru import logger import argparse from transformers import BertTokenizerFast import sys sys.path.append('../..') from textgen.language_generation import LanguageGenerationModel from textgen.language_modeling import Langua...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/text_augmentation/generate_error_char_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.720159
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.augment import TextAugment if __name__ == '__main__': m = TextAugment() sentences = [ '主要研究机器学习、深度学习、计算机视觉、智能对话系统相关内容', '希望你们好好的跳舞', '少先队员应该为老人让座', '...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/songnet/training_zh_songnet_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.733386
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os import argparse from loguru import logger import sys sys.path.append('../..') from textgen.language_modeling import SongNetModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--train_file', default=...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/seq2seq/training_seq2seq_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.734371
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import sys from loguru import logger sys.path.append('../..') from textgen.seq2seq import Seq2SeqModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--train_file', default='../data/zh_dialog....
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/songnet/songnet_couplet_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.742912
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.language_modeling import SongNetModel if __name__ == '__main__': # Use fine-tuned model model = SongNetModel(model_type='songnet', model_name='shibing624/songnet-base-chinese-couplet...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/seq2seq/training_convseq2seq_model_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.744362
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse from loguru import logger import sys sys.path.append('../..') from textgen.seq2seq import ConvSeq2SeqModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--train_file', default='../data/zh_dial...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/songnet/songnet_songci_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.779053
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.language_modeling import SongNetModel if __name__ == '__main__': # Use fine-tuned model model = SongNetModel(model_type='songnet', model_name='shibing624/songnet-base-chinese-songci...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/seq2seq/training_bartseq2seq_zh_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.856804
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import pandas as pd from loguru import logger import os from transformers import BertTokenizerFast from transformers import BartForConditionalGeneration, Text2TextGenerationPipeline import sys sys.path.append('../..') from t...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/gpt2/training_en_gpt2_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.909931
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.language_generation import LanguageGenerationModel from textgen.language_modeling import LanguageModelingModel def raw(prompts): model = LanguageGenerationModel("gpt2", "gpt2", args={...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/seq2seq/training_bartseq2seq_toy_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.932811
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import pandas as pd from loguru import logger import os import sys sys.path.append('../..') from textgen.seq2seq import BartSeq2SeqModel def main(): parser = argparse.ArgumentParser() parser.add_argument('--model_t...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/seq2seq/training_bartseq2seq_en_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:43.933447
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os import argparse import pandas as pd from loguru import logger import sys sys.path.append('../..') from textgen.seq2seq import BartSeq2SeqModel def load_qa_data(file_path): data = [] with open(file_path, 'r', encoding='ut...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/text_augmentation/text_augmentation_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.303625
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('../..') from textgen.augment import TextAugment if __name__ == '__main__': m = TextAugment() a = '主要研究机器学习、深度学习、计算机视觉、智能对话系统相关内容' print(a) b = m.augment(a, aug_ops='random-0.2') print('rand...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/answer_by_chatgpt.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.323482
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import json import os import time import openai from loguru import logger from tenacity import ( retry, stop_after_attempt, wait_random_exponential, ) from tqdm import tqdm openai.api_key = os.getenv("OPENAI_API...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_ceval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.325245
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: wget https://huggingface.co/datasets/ceval/ceval-exam/resolve/main/ceval-exam.zip mkdir data/ceval mv ceval-exam.zip data/ceval cd data/ceval; unzip ceval-exam.zip...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
examples/unsup_generation/unsup_generation_demo.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.369940
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os import sys sys.path.append('../..') from textgen.unsup_generation import TglsModel, load_list pwd_path = os.path.abspath(os.path.dirname(__file__)) samples = load_list(os.path.join(pwd_path, './data/ecommerce_comments.txt')) m ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/convert_to_sharegpt_dataset.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.370471
""" Convert alpaca dataset into sharegpt format. Usage: python convert_alpaca.py --in_file alpaca_data.json --out_file alpaca_data_sharegpt.json """ import argparse from datasets import load_dataset if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--in_file", type=str) ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_chat_ceval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.415183
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: wget https://huggingface.co/datasets/ceval/ceval-exam/resolve/main/ceval-exam.zip mkdir data/ceval mv ceval-exam.zip data/ceval cd data/ceval; unzip ceval-exam.zip cd ../../ pip install thefuzz python eval/evaluate_chat_ceval.py -d data/ceval ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_chat_gsm8k.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.456711
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: python eval/evaluate_chat_gsm8k.py [--use-fewshot] """ import argparse import json import re from pathlib import Path import numpy as np import torch import tqdm ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_chat_humaneval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.486822
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: Get the HumanEval.jsonl file from [here](https://github.com/openai/human-eval/tree/master/data) python eval/evaluate_chat_humaneval.py -f HumanEval.jsonl -o Human...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_chat_mmlu.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.524038
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: wget https://people.eecs.berkeley.edu/~hendrycks/data.tar mkdir data/mmlu mv data.tar data/mmlu cd data/mmlu; tar xf data.tar cd ../../ pip install thefuzz python...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_cmmlu.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.545336
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: wget https://huggingface.co/datasets/haonan-li/cmmlu/resolve/main/cmmlu_v1_0_1.zip mkdir data/cmmlu mv cmmlu_v1_0_1.zip data/cmmlu cd data/cmmlu; unzip cmmlu_v1_0_...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_gsm8k.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.902117
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: python eval/evaluate_chat_gsm8k.py [--use-fewshot] """ import argparse import re import datasets import jsonlines import numpy as np import torch from datasets im...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_humaneval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.904775
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: git clone https://github.com/openai/human-eval $ pip install -e human-eval evaluate_functional_correctness sample-output-file """ import argparse import jsonlines...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_mmlu.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.933526
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md usage: wget https://people.eecs.berkeley.edu/~hendrycks/data.tar mkdir data/mmlu mv data.tar data/mmlu cd data/mmlu; tar xf data.tar cd ../../ python eval/evaluate_mmlu.p...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/eval/evaluate_plugin.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.969704
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: code from https://github.com/QwenLM/Qwen-7B/blob/main/eval/EVALUATION.md """ import argparse import json import os import pprint import json5 import jsonlines from rouge_score import rouge_scorer from tqdm import tqdm from transformers impor...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/generate_sft_data.py
null
null
null
null
null
null
Python
2026-05-04T02:34:44.971665
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import json import os import re import time from multiprocessing.dummy import Pool from random import choices import openai from loguru import logger from tenacity import ( retry, stop_after_attempt, wait_random_...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/evaluate_sft_data.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.001146
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import argparse import json import os import time import openai from loguru import logger from tenacity import ( retry, stop_after_attempt, wait_random_exponential, ) from tqdm import tqdm openai.api_key = os.getenv("OPENAI_API...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
setup.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.045287
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.md', 'r', encoding='utf-8') as f: readme = f.read() setup( name='textgen', version='1.1.1', description='Text Generation Model', long_description=readme, long_description_content_type='text/markdown', au...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_benchmark.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.083843
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os import sys import pandas as pd sys.path.append('..') from textgen import GptModel pwd_path = os.path.abspath(os.path.dirname(__file__)) def get_alpaca_prompt(instruction): return f"""Below is an instruction that describe...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_chatglm.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.084428
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('..') from textgen import GptModel def test_csc(): from pycorrector.utils import eval model = GptModel( 'chatglm', "THUDM/chatglm-6b", peft_name="shibing624/chatglm-6b-csc-zh-lora", arg...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_chatglm_training.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.195954
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys import os import pytest from torch.utils.data import Dataset from datasets import load_dataset, load_from_disk sys.path.append('..') from textgen import GptModel def preprocess_batch_for_hf_dataset(example, tokenizer, args): ...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_dataset.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.494038
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys import pandas as pd from loguru import logger from transformers import AutoTokenizer sys.path.append('..') from textgen import GptSupervisedDataset from textgen import GptArgs def load_data(file_path): return [i for i in...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_llama.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.560027
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys sys.path.append('..') from textgen import GptModel def generate_prompt(instruction): return f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
tests/test_save_args.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.560624
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import sys import pytest import shutil import os from loguru import logger from torch.utils.data import Dataset sys.path.append('..') from textgen import ChatGlmArgs class MyTestDataset(Dataset): pass def test_save_args(): arg...
shibing624/textgen
https://github.com/shibing624/textgen
null
null
null
null
979
null
null
apache-2.0
null
null
null
null
null
null
null
textgen/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:34:45.593935
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ __version__ = '1.1.2' from textgen.augment.text_augment import TextAugment from textgen.config.model_args import LanguageGenerationArgs from textgen.language_generation.language_generation_model import LanguageGenerationModel from textg...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/convert_mmvet_for_eval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.806414
import os import json import argparse parser = argparse.ArgumentParser() parser.add_argument("--src", type=str) parser.add_argument("--dst", type=str) args = parser.parse_args() cur_result = {} for line in open(args.src): data = json.loads(line) qid = data['question_id'] cur_result[f'v1_{qid}'] = data['t...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
tinyllava/data/dataset.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.807330
import copy from dataclasses import dataclass import json from typing import Dict, Sequence, TYPE_CHECKING from PIL import Image, ImageFile import os from .text_preprocess import TextPreprocess from .image_preprocess import ImagePreprocess from ..utils.arguments import DataArguments from ..utils.constants import * ...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
tinyllava/data/image_preprocess.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.832244
import os from PIL import Image, ImageFile import torch import ast from ..utils.data_utils import * ImageFile.LOAD_TRUNCATED_IMAGES = True # 可能imagepreprocess需要继承一个huggingface的图像处理类?提供from_pretrained方法 class ImagePreprocess: def __init__(self, image_processor, data_args={}): self.image_aspect_ratio = g...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
tinyllava/data/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.833056
from .template import * from .image_preprocess import * from .text_preprocess import * from .dataset import *
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/convert_gqa_for_eval.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.856990
import os import json import argparse parser = argparse.ArgumentParser() parser.add_argument("--src", type=str) parser.add_argument("--dst", type=str) args = parser.parse_args() all_answers = [] for line_idx, line in enumerate(open(args.src)): res = json.loads(line) question_id = res['question_id'] text =...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
tinyllava/data/template/base.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.858528
from dataclasses import dataclass from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union import copy from .formatter import EmptyFormatter, StringFormatter from .formatter import Formatter from ...utils.constants import * from transformers import PreTrainedTokenizer import torch @datacl...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/convert_answer_to_mmmu.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.879418
import argparse import json import os def eval_model(args): answers = [json.loads(q) for q in open(os.path.expanduser(args.answers_file), "r")] answers_dict = {} for answer in answers: answers_dict[answer["question_id"]] = answer["text"] # print(answer) with open(args.answers_output, ...
TinyLLaVA/TinyLLaVA_Factory
https://github.com/TinyLLaVA/TinyLLaVA_Factory
null
null
null
null
977
null
null
apache-2.0
null
null
null
null
null
null
null
scripts/convert_vqav2_for_submission.py
null
null
null
null
null
null
Python
2026-05-04T02:34:47.880526
import os import argparse import json from tinyllava.eval.m4c_evaluator import EvalAIAnswerProcessor def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--dir', type=str, default="./playground/data/eval/vqav2") parser.add_argument('--ckpt', type=str, required=True) parser.add_ar...