- -
-
-
- -
-
- -
- Lincon Legal Text Summarizer - Made Using Legal-Bert - - -
- - - -
- -
-
- Input Legal Text - - -
- -
- -
- -
- - -
-
-
- -
-
-
-
- -
- -
- -
- - - -
- Upload Legal Document - -
- - -
- -
- - - -
-
-
-
- 5 Pages Per Minute -
-
- -
- - - -
-
-
- -
- - - diff --git a/spaces/artificialguybr/video-dubbing/TTS/TTS/tts/configs/fast_speech_config.py b/spaces/artificialguybr/video-dubbing/TTS/TTS/tts/configs/fast_speech_config.py deleted file mode 100644 index af6c2db6faf55ee2b15047fff86281d42dab1b87..0000000000000000000000000000000000000000 --- a/spaces/artificialguybr/video-dubbing/TTS/TTS/tts/configs/fast_speech_config.py +++ /dev/null @@ -1,177 +0,0 @@ -from dataclasses import dataclass, field -from typing import List - -from TTS.tts.configs.shared_configs import BaseTTSConfig -from TTS.tts.models.forward_tts import ForwardTTSArgs - - -@dataclass -class FastSpeechConfig(BaseTTSConfig): - """Configure `ForwardTTS` as FastSpeech model. - - Example: - - >>> from TTS.tts.configs.fast_speech_config import FastSpeechConfig - >>> config = FastSpeechConfig() - - Args: - model (str): - Model name used for selecting the right model at initialization. Defaults to `fast_pitch`. - - base_model (str): - Name of the base model being configured as this model so that 🐸 TTS knows it needs to initiate - the base model rather than searching for the `model` implementation. Defaults to `forward_tts`. - - model_args (Coqpit): - Model class arguments. Check `FastSpeechArgs` for more details. Defaults to `FastSpeechArgs()`. - - data_dep_init_steps (int): - Number of steps used for computing normalization parameters at the beginning of the training. GlowTTS uses - Activation Normalization that pre-computes normalization stats at the beginning and use the same values - for the rest. Defaults to 10. - - speakers_file (str): - Path to the file containing the list of speakers. Needed at inference for loading matching speaker ids to - speaker names. Defaults to `None`. - - - use_speaker_embedding (bool): - enable / disable using speaker embeddings for multi-speaker models. If set True, the model is - in the multi-speaker mode. Defaults to False. - - use_d_vector_file (bool): - enable /disable using external speaker embeddings in place of the learned embeddings. Defaults to False. - - d_vector_file (str): - Path to the file including pre-computed speaker embeddings. Defaults to None. - - d_vector_dim (int): - Dimension of the external speaker embeddings. Defaults to 0. - - optimizer (str): - Name of the model optimizer. Defaults to `Adam`. - - optimizer_params (dict): - Arguments of the model optimizer. Defaults to `{"betas": [0.9, 0.998], "weight_decay": 1e-6}`. - - lr_scheduler (str): - Name of the learning rate scheduler. Defaults to `Noam`. - - lr_scheduler_params (dict): - Arguments of the learning rate scheduler. Defaults to `{"warmup_steps": 4000}`. - - lr (float): - Initial learning rate. Defaults to `1e-3`. - - grad_clip (float): - Gradient norm clipping value. Defaults to `5.0`. - - spec_loss_type (str): - Type of the spectrogram loss. Check `ForwardTTSLoss` for possible values. Defaults to `mse`. - - duration_loss_type (str): - Type of the duration loss. Check `ForwardTTSLoss` for possible values. Defaults to `mse`. - - use_ssim_loss (bool): - Enable/disable the use of SSIM (Structural Similarity) loss. Defaults to True. - - wd (float): - Weight decay coefficient. Defaults to `1e-7`. - - ssim_loss_alpha (float): - Weight for the SSIM loss. If set 0, disables the SSIM loss. Defaults to 1.0. - - dur_loss_alpha (float): - Weight for the duration predictor's loss. If set 0, disables the huber loss. Defaults to 1.0. - - spec_loss_alpha (float): - Weight for the L1 spectrogram loss. If set 0, disables the L1 loss. Defaults to 1.0. - - pitch_loss_alpha (float): - Weight for the pitch predictor's loss. If set 0, disables the pitch predictor. Defaults to 1.0. - - binary_loss_alpha (float): - Weight for the binary loss. If set 0, disables the binary loss. Defaults to 1.0. - - binary_loss_warmup_epochs (float): - Number of epochs to gradually increase the binary loss impact. Defaults to 150. - - min_seq_len (int): - Minimum input sequence length to be used at training. - - max_seq_len (int): - Maximum input sequence length to be used at training. Larger values result in more VRAM usage. - """ - - model: str = "fast_speech" - base_model: str = "forward_tts" - - # model specific params - model_args: ForwardTTSArgs = field(default_factory=lambda: ForwardTTSArgs(use_pitch=False)) - - # multi-speaker settings - num_speakers: int = 0 - speakers_file: str = None - use_speaker_embedding: bool = False - use_d_vector_file: bool = False - d_vector_file: str = False - d_vector_dim: int = 0 - - # optimizer parameters - optimizer: str = "Adam" - optimizer_params: dict = field(default_factory=lambda: {"betas": [0.9, 0.998], "weight_decay": 1e-6}) - lr_scheduler: str = "NoamLR" - lr_scheduler_params: dict = field(default_factory=lambda: {"warmup_steps": 4000}) - lr: float = 1e-4 - grad_clip: float = 5.0 - - # loss params - spec_loss_type: str = "mse" - duration_loss_type: str = "mse" - use_ssim_loss: bool = True - ssim_loss_alpha: float = 1.0 - dur_loss_alpha: float = 1.0 - spec_loss_alpha: float = 1.0 - pitch_loss_alpha: float = 0.0 - aligner_loss_alpha: float = 1.0 - binary_align_loss_alpha: float = 1.0 - binary_loss_warmup_epochs: int = 150 - - # overrides - min_seq_len: int = 13 - max_seq_len: int = 200 - r: int = 1 # DO NOT CHANGE - - # dataset configs - compute_f0: bool = False - f0_cache_path: str = None - - # testing - test_sentences: List[str] = field( - default_factory=lambda: [ - "It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.", - "Be a voice, not an echo.", - "I'm sorry Dave. I'm afraid I can't do that.", - "This cake is great. It's so delicious and moist.", - "Prior to November 22, 1963.", - ] - ) - - def __post_init__(self): - # Pass multi-speaker parameters to the model args as `model.init_multispeaker()` looks for it there. - if self.num_speakers > 0: - self.model_args.num_speakers = self.num_speakers - - # speaker embedding settings - if self.use_speaker_embedding: - self.model_args.use_speaker_embedding = True - if self.speakers_file: - self.model_args.speakers_file = self.speakers_file - - # d-vector settings - if self.use_d_vector_file: - self.model_args.use_d_vector_file = True - if self.d_vector_dim is not None and self.d_vector_dim > 0: - self.model_args.d_vector_dim = self.d_vector_dim - if self.d_vector_file: - self.model_args.d_vector_file = self.d_vector_file diff --git a/spaces/artificialguybr/video-dubbing/TTS/TTS/tts/utils/text/belarusian/__init__.py b/spaces/artificialguybr/video-dubbing/TTS/TTS/tts/utils/text/belarusian/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/artificialguybr/video-dubbing/TTS/recipes/kokoro/tacotron2-DDC/run.sh b/spaces/artificialguybr/video-dubbing/TTS/recipes/kokoro/tacotron2-DDC/run.sh deleted file mode 100644 index 69800cf7b4e9b518a352191498ec50e44af86f90..0000000000000000000000000000000000000000 --- a/spaces/artificialguybr/video-dubbing/TTS/recipes/kokoro/tacotron2-DDC/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# take the scripts's parent's directory to prefix all the output paths. -RUN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -CORPUS=kokoro-speech-v1_1-small -echo $RUN_DIR -if [ \! -d $RUN_DIR/$CORPUS ] ; then - echo "$RUN_DIR/$CORPUS doesn't exist." - echo "Follow the instruction of https://github.com/kaiidams/Kokoro-Speech-Dataset to make the corpus." - exit 1 -fi -# create train-val splits -shuf $RUN_DIR/$CORPUS/metadata.csv > $RUN_DIR/$CORPUS/metadata_shuf.csv -head -n 8000 $RUN_DIR/$CORPUS/metadata_shuf.csv > $RUN_DIR/$CORPUS/metadata_train.csv -tail -n 812 $RUN_DIR/$CORPUS/metadata_shuf.csv > $RUN_DIR/$CORPUS/metadata_val.csv -# compute dataset mean and variance for normalization -python TTS/bin/compute_statistics.py $RUN_DIR/tacotron2-DDC.json $RUN_DIR/scale_stats.npy --data_path $RUN_DIR/$CORPUS/wavs/ -# training .... -# change the GPU id if needed -CUDA_VISIBLE_DEVICES="0" python TTS/bin/train_tts.py --config_path $RUN_DIR/tacotron2-DDC.json \ - --coqpit.output_path $RUN_DIR \ - --coqpit.datasets.0.path $RUN_DIR/$CORPUS \ - --coqpit.audio.stats_path $RUN_DIR/scale_stats.npy \ - --coqpit.phoneme_cache_path $RUN_DIR/phoneme_cache \ \ No newline at end of file diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Utility/ModuleSetupCode.c b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Utility/ModuleSetupCode.c deleted file mode 100644 index f7af78bfa74d85ee0757c59ca41ab27f9ab62dc1..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Utility/ModuleSetupCode.c +++ /dev/null @@ -1,1640 +0,0 @@ -/////////////// CModulePreamble /////////////// - -#include /* For offsetof */ -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -// For use in DL_IMPORT/DL_EXPORT macros. -#define __PYX_COMMA , - -#ifndef HAVE_LONG_LONG - // CPython has required PY_LONG_LONG support for years, even if HAVE_LONG_LONG is not defined for us - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif - -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900) - #endif - -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif - -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - // looks like calling _PyType_Lookup() isn't safe in Py<=2.6/3.1 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - // Python 3.11a2 hid _PyLong_FormatAdvancedWriter and _PyFloat_FormatAdvancedWriter - // therefore disable unicode writer until a better alternative appears - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - // Python 3.11 deleted localplus argument from frame object, which is used in our - // fast_pycall code - // On Python 3.10 it causes issues when used while profiling/debugging - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) - #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif -#endif - -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif - -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - /* These short defines can easily conflict with other code */ - #undef SHIFT - #undef BASE - #undef MASK - /* Compile-time sanity check that these are indeed equal. Github issue #2670. */ - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif - -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif - -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif - -// restrict -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif - -// unused attribute -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif - -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif - -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif - - -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 /* Xcode < 7.0 */ - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -/////////////// CInitCode /////////////// - -// inline attribute -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - - -/////////////// CppInitCode /////////////// - -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif - -// inline attribute -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #else - #define CYTHON_INLINE inline - #endif -#endif - -// Work around clang bug http://stackoverflow.com/questions/21847816/c-invoke-nested-template-class-destructor -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} - -// Used for temporary variables of "reference" type. -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - // __Pyx_FakeReference(T& ref) : ptr(&ref) { } - // Const version needed as Cython doesn't know about const overloads (e.g. for stl containers). - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - T *operator&() { return ptr; } - operator T&() { return *ptr; } - // TODO(robertwb): Delegate all operators (or auto-generate unwrapping code where needed). - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } - private: - T *ptr; -}; - - -/////////////// PythonCompatibility /////////////// - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" - -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, - PyObject *code, PyObject *c, PyObject* n, PyObject *v, - PyObject *fv, PyObject *cell, PyObject* fn, - PyObject *name, int fline, PyObject *lnos) { - // TODO - currently written to be simple and work in limited API etc. - // A more optimized version would be good - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; - PyObject *type, *value, *traceback; - - // we must be able to call this while an exception is happening - thus clear then restore the state - PyErr_Fetch(&type, &value, &traceback); - - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); - if (type) { - PyErr_Restore(type, value, traceback); - } - return co; - } -#else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif - #define __Pyx_DefaultClassType PyType_Type -#endif - -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif - -#ifndef METH_STACKLESS - // already defined for Stackless Python (all versions) and C-Python >= 3.7 - // value if defined: Stackless Python < 3.6: 0x80 else 0x100 - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - // new in CPython 3.6, but changed in 3.7 - see - // positional-only parameters: - // https://bugs.python.org/issue29464 - // const args: - // https://bugs.python.org/issue32240 - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - // new in CPython 3.7, used to be old signature of _PyCFunctionFast() in 3.6 - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func) \ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif - -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif - -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif - -#if CYTHON_COMPILING_IN_PYSTON - // special C-API functions only in Pyston - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif - -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - //#elif PY_VERSION_HEX >= 0x03050200 - // Actually added in 3.5.2, but compiling against that does not guarantee that we get imported there. - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif - -// TSS (Thread Specific Storage) API -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; /* PyThread_create_key reports success always */ -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -// PyThread_delete_key_value(key) is equalivalent to PyThread_set_key_value(key, NULL) -// PyThread_ReInitTLS() is a no-op -#endif /* TSS (Thread Specific Storage) API */ - -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif - -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif - -/* new Py3.3 unicode type (PEP 393) */ -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else - // Py3.12 / PEP-623 will remove wstr type unicode strings and all of the PyUnicode_READY() machinery. - #define __Pyx_PyUnicode_READY(op) (0) - #endif - - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - // Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12. - // https://www.python.org/dev/peps/pep-0623/ - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) - #endif -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - /* (void)(k) => avoid unused variable warning due to macro: */ - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif - -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif - -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif - -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif - -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif - -// ("..." % x) must call PyNumber_Remainder() if x is a string subclass that implements "__rmod__()". -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif - -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact - // PyPy3 used to define "PyObject_Unicode" -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif - -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - - -#if PY_VERSION_HEX >= 0x030900A4 - #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) -#else - #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) -#endif - -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - // NOTE: might fail with exception => check for -1 - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif - -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif - -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif - -// backport of PyAsyncMethods from Py3.5 to older Py3.x versions -// (mis-)using the "tp_reserved" type slot which is re-activated as "tp_as_async" in Py3.5 -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - - -/////////////// SmallCodeConfig.proto /////////////// - -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - - -/////////////// PyModInitFuncType.proto /////////////// - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC - -#elif PY_MAJOR_VERSION < 3 -// Py2: define this to void manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition. -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif - -#else -// Py3+: define this to PyObject * manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition. -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -/////////////// FastTypeChecks.proto /////////////// - -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);/*proto*/ -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);/*proto*/ -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);/*proto*/ -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif - -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/////////////// FastTypeChecks /////////////// -//@requires: Exceptions.c::PyThreadStateGet -//@requires: Exceptions.c::PyErrFetchRestore - -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} - -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - // should only get here for incompletely initialised types, i.e. never under normal usage patterns - return __Pyx_InBases(a, b); -} - - -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - // PyObject_IsSubclass() can recurse and therefore is not safe - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - // This function must not fail, so print the error here (which also clears it) - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - // This function must not fail, so print the error here (which also clears it) - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif - -// so far, we only call PyErr_GivenExceptionMatches() with an exception type (not instance) as first argument -// => optimise for that case - -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - // the tighter subtype checking in Py3 allows faster out-of-order comparison - for (i=0; i pure safety check assertions. - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); - } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); -} - -#endif - - -/////////////// MathInitCode /////////////// - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include - -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - // Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and - // a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is - // a quiet NaN. - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif - -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -/////////////// UtilityFunctionPredeclarations.proto /////////////// - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -/////////////// ForceInitThreads.proto /////////////// -//@proto_block: utility_code_proto_before_types - -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/////////////// InitThreads.init /////////////// - -#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - - -/////////////// ModuleCreationPEP489 /////////////// -//@substitute: naming - -//#if CYTHON_PEP489_MULTI_PHASE_INIT -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} - -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} - -static CYTHON_SMALL_CODE PyObject* ${pymodule_create_func_cname}(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - - // For now, we only have exactly one module instance. - if (__Pyx_check_single_interpreter()) - return NULL; - if (${module_cname}) - return __Pyx_NewRef(${module_cname}); - - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - // moddict is a borrowed reference - - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - - return module; -bad: - Py_XDECREF(module); - return NULL; -} -//#endif - - -/////////////// CodeObjectCache.proto /////////////// - -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; - -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; - -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; - -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/////////////// CodeObjectCache /////////////// -// Note that errors are simply ignored in the code below. -// This is just a cache, if a lookup or insertion fails - so what? - -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} - -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} - -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/////////////// CodeObjectCache.cleanup /////////////// - - if (__pyx_code_cache.entries) { - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - int i, count = __pyx_code_cache.count; - __pyx_code_cache.count = 0; - __pyx_code_cache.max_count = 0; - __pyx_code_cache.entries = NULL; - for (i=0; i '9'); - break; - } - if (rt_from_call[i] != ctversion[i]) { - same = 0; - break; - } - } - - if (!same) { - char rtversion[5] = {'\0'}; - // copy the runtime-version for the error message - char message[200]; - for (i=0; i<4; ++i) { - if (rt_from_call[i] == '.') { - if (found_dot) break; - found_dot = 1; - } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { - break; - } - rtversion[i] = rt_from_call[i]; - } - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/////////////// IsLittleEndian.proto /////////////// - -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/////////////// IsLittleEndian /////////////// - -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; -} - -/////////////// Refnanny.proto /////////////// - -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif - -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil) \ - if (acquire_gil) { \ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ - PyGILState_Release(__pyx_gilstate_save); \ - } else { \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil) \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext() \ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif /* CYTHON_REFNANNY */ - -#define __Pyx_XDECREF_SET(r, v) do { \ - PyObject *tmp = (PyObject *) r; \ - r = v; __Pyx_XDECREF(tmp); \ - } while (0) -#define __Pyx_DECREF_SET(r, v) do { \ - PyObject *tmp = (PyObject *) r; \ - r = v; __Pyx_DECREF(tmp); \ - } while (0) - -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/////////////// Refnanny /////////////// - -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif /* CYTHON_REFNANNY */ - - -/////////////// ImportRefnannyAPI /////////////// - -#if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - - -/////////////// RegisterModuleCleanup.proto /////////////// -//@substitute: naming - -static void ${cleanup_cname}(PyObject *self); /*proto*/ - -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static int __Pyx_RegisterCleanup(void); /*proto*/ -#else -#define __Pyx_RegisterCleanup() (0) -#endif - -/////////////// RegisterModuleCleanup /////////////// -//@substitute: naming - -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject* ${cleanup_cname}_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) { - ${cleanup_cname}(module); - Py_INCREF(Py_None); return Py_None; -} - -static int __Pyx_RegisterCleanup(void) { - // Don't use Py_AtExit because that has a 32-call limit and is called - // after python finalization. - // Also, we try to prepend the cleanup function to "atexit._exithandlers" - // in Py2 because CPython runs them last-to-first. Being run last allows - // user exit code to run before us that may depend on the globals - // and cached objects that we are about to clean up. - - static PyMethodDef cleanup_def = { - "__cleanup", (PyCFunction)${cleanup_cname}_atexit, METH_NOARGS, 0}; - - PyObject *cleanup_func = 0; - PyObject *atexit = 0; - PyObject *reg = 0; - PyObject *args = 0; - PyObject *res = 0; - int ret = -1; - - cleanup_func = PyCFunction_New(&cleanup_def, 0); - if (!cleanup_func) - goto bad; - - atexit = PyImport_ImportModule("atexit"); - if (!atexit) - goto bad; - reg = PyObject_GetAttrString(atexit, "_exithandlers"); - if (reg && PyList_Check(reg)) { - PyObject *a, *kw; - a = PyTuple_New(0); - kw = PyDict_New(); - if (!a || !kw) { - Py_XDECREF(a); - Py_XDECREF(kw); - goto bad; - } - args = PyTuple_Pack(3, cleanup_func, a, kw); - Py_DECREF(a); - Py_DECREF(kw); - if (!args) - goto bad; - ret = PyList_Insert(reg, 0, args); - } else { - if (!reg) - PyErr_Clear(); - Py_XDECREF(reg); - reg = PyObject_GetAttrString(atexit, "register"); - if (!reg) - goto bad; - args = PyTuple_Pack(1, cleanup_func); - if (!args) - goto bad; - res = PyObject_CallObject(reg, args); - if (!res) - goto bad; - ret = 0; - } -bad: - Py_XDECREF(cleanup_func); - Py_XDECREF(atexit); - Py_XDECREF(reg); - Py_XDECREF(args); - Py_XDECREF(res); - return ret; -} -#endif - -/////////////// FastGil.init /////////////// -#ifdef WITH_THREAD -__Pyx_FastGilFuncInit(); -#endif - -/////////////// NoFastGil.proto /////////////// -//@proto_block: utility_code_proto_before_types - -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/////////////// FastGil.proto /////////////// -//@proto_block: utility_code_proto_before_types - -struct __Pyx_FastGilVtab { - PyGILState_STATE (*Fast_PyGILState_Ensure)(void); - void (*Fast_PyGILState_Release)(PyGILState_STATE oldstate); - void (*FastGIL_Remember)(void); - void (*FastGIL_Forget)(void); -}; - -static void __Pyx_FastGIL_Noop(void) {} -static struct __Pyx_FastGilVtab __Pyx_FastGilFuncs = { - PyGILState_Ensure, - PyGILState_Release, - __Pyx_FastGIL_Noop, - __Pyx_FastGIL_Noop -}; - -static void __Pyx_FastGilFuncInit(void); - -#define __Pyx_PyGILState_Ensure __Pyx_FastGilFuncs.Fast_PyGILState_Ensure -#define __Pyx_PyGILState_Release __Pyx_FastGilFuncs.Fast_PyGILState_Release -#define __Pyx_FastGIL_Remember __Pyx_FastGilFuncs.FastGIL_Remember -#define __Pyx_FastGIL_Forget __Pyx_FastGilFuncs.FastGIL_Forget - -#ifdef WITH_THREAD - #ifndef CYTHON_THREAD_LOCAL - #if __STDC_VERSION__ >= 201112 - #define CYTHON_THREAD_LOCAL _Thread_local - #elif defined(__GNUC__) - #define CYTHON_THREAD_LOCAL __thread - #elif defined(_MSC_VER) - #define CYTHON_THREAD_LOCAL __declspec(thread) - #endif - #endif -#endif - -/////////////// FastGil /////////////// -//@requires: CommonStructures.c::FetchCommonPointer -// The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value -// several times which is turns out to be quite slow (slower in fact than -// acquiring the GIL itself). Simply storing it in a thread local for the -// common case is much faster. -// To make optimal use of this thread local, we attempt to share it between -// modules. - -#define __Pyx_FastGIL_ABI_module "_cython_" CYTHON_ABI -#define __Pyx_FastGIL_PyCapsuleName "FastGilFuncs" -#define __Pyx_FastGIL_PyCapsule \ - __Pyx_FastGIL_ABI_module "." __Pyx_FastGIL_PyCapsuleName - -#if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_THREAD_LOCAL -#endif - -#ifdef CYTHON_THREAD_LOCAL - -#include "pythread.h" -#include "pystate.h" - -static CYTHON_THREAD_LOCAL PyThreadState *__Pyx_FastGil_tcur = NULL; -static CYTHON_THREAD_LOCAL int __Pyx_FastGil_tcur_depth = 0; -static int __Pyx_FastGil_autoTLSkey = -1; - -static CYTHON_INLINE void __Pyx_FastGIL_Remember0(void) { - ++__Pyx_FastGil_tcur_depth; -} - -static CYTHON_INLINE void __Pyx_FastGIL_Forget0(void) { - if (--__Pyx_FastGil_tcur_depth == 0) { - __Pyx_FastGil_tcur = NULL; - } -} - -static CYTHON_INLINE PyThreadState *__Pyx_FastGil_get_tcur(void) { - PyThreadState *tcur = __Pyx_FastGil_tcur; - if (tcur == NULL) { - tcur = __Pyx_FastGil_tcur = (PyThreadState*)PyThread_get_key_value(__Pyx_FastGil_autoTLSkey); - } - return tcur; -} - -static PyGILState_STATE __Pyx_FastGil_PyGILState_Ensure(void) { - int current; - PyThreadState *tcur; - __Pyx_FastGIL_Remember0(); - tcur = __Pyx_FastGil_get_tcur(); - if (tcur == NULL) { - // Uninitialized, need to initialize now. - return PyGILState_Ensure(); - } - current = tcur == __Pyx_PyThreadState_Current; - if (current == 0) { - PyEval_RestoreThread(tcur); - } - ++tcur->gilstate_counter; - return current ? PyGILState_LOCKED : PyGILState_UNLOCKED; -} - -static void __Pyx_FastGil_PyGILState_Release(PyGILState_STATE oldstate) { - PyThreadState *tcur = __Pyx_FastGil_get_tcur(); - __Pyx_FastGIL_Forget0(); - if (tcur->gilstate_counter == 1) { - // This is the last lock, do all the cleanup as well. - PyGILState_Release(oldstate); - } else { - --tcur->gilstate_counter; - if (oldstate == PyGILState_UNLOCKED) { - PyEval_SaveThread(); - } - } -} - -static void __Pyx_FastGilFuncInit0(void) { - /* Try to detect autoTLSkey. */ - int key; - void* this_thread_state = (void*) PyGILState_GetThisThreadState(); - for (key = 0; key < 100; key++) { - if (PyThread_get_key_value(key) == this_thread_state) { - __Pyx_FastGil_autoTLSkey = key; - break; - } - } - if (__Pyx_FastGil_autoTLSkey != -1) { - PyObject* capsule = NULL; - PyObject* abi_module = NULL; - __Pyx_PyGILState_Ensure = __Pyx_FastGil_PyGILState_Ensure; - __Pyx_PyGILState_Release = __Pyx_FastGil_PyGILState_Release; - __Pyx_FastGIL_Remember = __Pyx_FastGIL_Remember0; - __Pyx_FastGIL_Forget = __Pyx_FastGIL_Forget0; - capsule = PyCapsule_New(&__Pyx_FastGilFuncs, __Pyx_FastGIL_PyCapsule, NULL); - abi_module = PyImport_AddModule(__Pyx_FastGIL_ABI_module); - if (capsule && abi_module) { - PyObject_SetAttrString(abi_module, __Pyx_FastGIL_PyCapsuleName, capsule); - } - Py_XDECREF(capsule); - } -} - -#else - -static void __Pyx_FastGilFuncInit0(void) { - CYTHON_UNUSED void* force_use = (void*)&__Pyx_FetchCommonPointer; -} - -#endif - -static void __Pyx_FastGilFuncInit(void) { -#if PY_VERSION_HEX >= 0x02070000 - struct __Pyx_FastGilVtab* shared = (struct __Pyx_FastGilVtab*)PyCapsule_Import(__Pyx_FastGIL_PyCapsule, 1); -#else - struct __Pyx_FastGilVtab* shared = NULL; -#endif - if (shared) { - __Pyx_FastGilFuncs = *shared; - } else { - PyErr_Clear(); - __Pyx_FastGilFuncInit0(); - } -} diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/anyio/_core/_compat.py b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/anyio/_core/_compat.py deleted file mode 100644 index 7062be5daf03181b94a445d119ff66a1b1ddde2f..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/anyio/_core/_compat.py +++ /dev/null @@ -1,218 +0,0 @@ -from abc import ABCMeta, abstractmethod -from contextlib import AbstractContextManager -from types import TracebackType -from typing import ( - TYPE_CHECKING, - Any, - AsyncContextManager, - Callable, - ContextManager, - Generator, - Generic, - Iterable, - List, - Optional, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from warnings import warn - -if TYPE_CHECKING: - from ._testing import TaskInfo -else: - TaskInfo = object - -T = TypeVar("T") -AnyDeprecatedAwaitable = Union[ - "DeprecatedAwaitable", - "DeprecatedAwaitableFloat", - "DeprecatedAwaitableList[T]", - TaskInfo, -] - - -@overload -async def maybe_async(__obj: TaskInfo) -> TaskInfo: - ... - - -@overload -async def maybe_async(__obj: "DeprecatedAwaitableFloat") -> float: - ... - - -@overload -async def maybe_async(__obj: "DeprecatedAwaitableList[T]") -> List[T]: - ... - - -@overload -async def maybe_async(__obj: "DeprecatedAwaitable") -> None: - ... - - -async def maybe_async( - __obj: "AnyDeprecatedAwaitable[T]", -) -> Union[TaskInfo, float, List[T], None]: - """ - Await on the given object if necessary. - - This function is intended to bridge the gap between AnyIO 2.x and 3.x where some functions and - methods were converted from coroutine functions into regular functions. - - Do **not** try to use this for any other purpose! - - :return: the result of awaiting on the object if coroutine, or the object itself otherwise - - .. versionadded:: 2.2 - - """ - return __obj._unwrap() - - -class _ContextManagerWrapper: - def __init__(self, cm: ContextManager[T]): - self._cm = cm - - async def __aenter__(self) -> T: - return self._cm.__enter__() - - async def __aexit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> Optional[bool]: - return self._cm.__exit__(exc_type, exc_val, exc_tb) - - -def maybe_async_cm( - cm: Union[ContextManager[T], AsyncContextManager[T]] -) -> AsyncContextManager[T]: - """ - Wrap a regular context manager as an async one if necessary. - - This function is intended to bridge the gap between AnyIO 2.x and 3.x where some functions and - methods were changed to return regular context managers instead of async ones. - - :param cm: a regular or async context manager - :return: an async context manager - - .. versionadded:: 2.2 - - """ - if not isinstance(cm, AbstractContextManager): - raise TypeError("Given object is not an context manager") - - return _ContextManagerWrapper(cm) - - -def _warn_deprecation( - awaitable: "AnyDeprecatedAwaitable[Any]", stacklevel: int = 1 -) -> None: - warn( - f'Awaiting on {awaitable._name}() is deprecated. Use "await ' - f"anyio.maybe_async({awaitable._name}(...)) if you have to support both AnyIO 2.x " - f'and 3.x, or just remove the "await" if you are completely migrating to AnyIO 3+.', - DeprecationWarning, - stacklevel=stacklevel + 1, - ) - - -class DeprecatedAwaitable: - def __init__(self, func: Callable[..., "DeprecatedAwaitable"]): - self._name = f"{func.__module__}.{func.__qualname__}" - - def __await__(self) -> Generator[None, None, None]: - _warn_deprecation(self) - if False: - yield - - def __reduce__(self) -> Tuple[Type[None], Tuple[()]]: - return type(None), () - - def _unwrap(self) -> None: - return None - - -class DeprecatedAwaitableFloat(float): - def __new__( - cls, x: float, func: Callable[..., "DeprecatedAwaitableFloat"] - ) -> "DeprecatedAwaitableFloat": - return super().__new__(cls, x) - - def __init__(self, x: float, func: Callable[..., "DeprecatedAwaitableFloat"]): - self._name = f"{func.__module__}.{func.__qualname__}" - - def __await__(self) -> Generator[None, None, float]: - _warn_deprecation(self) - if False: - yield - - return float(self) - - def __reduce__(self) -> Tuple[Type[float], Tuple[float]]: - return float, (float(self),) - - def _unwrap(self) -> float: - return float(self) - - -class DeprecatedAwaitableList(List[T]): - def __init__( - self, - iterable: Iterable[T] = (), - *, - func: Callable[..., "DeprecatedAwaitableList[T]"], - ): - super().__init__(iterable) - self._name = f"{func.__module__}.{func.__qualname__}" - - def __await__(self) -> Generator[None, None, List[T]]: - _warn_deprecation(self) - if False: - yield - - return list(self) - - def __reduce__(self) -> Tuple[Type[List[T]], Tuple[List[T]]]: - return list, (list(self),) - - def _unwrap(self) -> List[T]: - return list(self) - - -class DeprecatedAsyncContextManager(Generic[T], metaclass=ABCMeta): - @abstractmethod - def __enter__(self) -> T: - pass - - @abstractmethod - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> Optional[bool]: - pass - - async def __aenter__(self) -> T: - warn( - f"Using {self.__class__.__name__} as an async context manager has been deprecated. " - f'Use "async with anyio.maybe_async_cm(yourcontextmanager) as foo:" if you have to ' - f'support both AnyIO 2.x and 3.x, or just remove the "async" from "async with" if ' - f"you are completely migrating to AnyIO 3+.", - DeprecationWarning, - ) - return self.__enter__() - - async def __aexit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> Optional[bool]: - return self.__exit__(exc_type, exc_val, exc_tb) diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/fairseq/examples/MMPT/pretraining.md b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/fairseq/examples/MMPT/pretraining.md deleted file mode 100644 index 8f8e6d0facaa47141342294d7eb26c4232a9677b..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/fairseq/examples/MMPT/pretraining.md +++ /dev/null @@ -1,29 +0,0 @@ -# Pretraining - -(If you are new to the ideas of `mmpt.processors`, see [README](README.md) first.) -We mostly use [howto100M](https://github.com/antoine77340/howto100m) dataset for pretraining (other datasets are coming). So you are less likely to write a new `MetaProcessor`, `VideoProcessor` or `TextProcessor` but only working on a new `Aligner`, a new model and loss. - -### Data Sharding -Pretraining on Howto100M is heavy on IO since we have millions of videos or captions on the hard disk that cannot be fit into the memory. -It is desirable to have an optimized preprocessing step before the actual dataloading. - -We support data sharding to pack multiple videos into a shards of training data for both videos and captions. (see [dataset](DATASET.md) for preprocessing). -These shards will be mapped into memory to reduce the frequency of IO access on millions of files. See (processors starting with `Sharded*`). -This will be the default config for a how2 dataset `projects/task/how2.yaml`. - -Great thanks to Dmytro Okhonko for sharing the code from MARGE project. - -### Training -Pretraining on Howto100m is expected on one or multiple nodes, where each node has 8 GPUS with 32 GB mem. -launching a pretraing on MFM+MLM can be done, via: -```python locallaunch.py projects/mfmmlm/how2.yaml``` - -### Pre-training with a Retrieval Model (VideoCLIP) -This projects now support alternatively run a retrieval model and pre-training. -We implement a basic retrieval model that is built on the hidden states of a video and faiss. - -You may need to install faiss via `conda install faiss-cpu -c pytorch`. - -Right now, the hidden states of a video is computed as the average of 8 clips of their pooled visual/text hidden states. -See `mmpt/tasks/retritask.py` for more details. -The `.yaml` config for running pre-training with a retrieval model can be found at `projects/retri/videoretri.yaml`. diff --git a/spaces/aryan29/movie-recommender-system/app.py b/spaces/aryan29/movie-recommender-system/app.py deleted file mode 100644 index 74f48144b685a94ab38e0f6e41e9e53c405e5b88..0000000000000000000000000000000000000000 --- a/spaces/aryan29/movie-recommender-system/app.py +++ /dev/null @@ -1,28 +0,0 @@ -import gradio as gr -import pickle -import pandas as pd - -df = pd.read_csv("model/movies.csv") - -with open("model/similarity.pkl", "rb") as f: - similarity = pickle.load(f) - -def recommendation(movie_title): - movie_title = movie_title.title() - try: - id_of_movie = df[df['title']==movie_title].index[0] - except IndexError: - return f"Error: Movie '{movie_title}' not found in database." - distances = similarity[id_of_movie] - movie_list = sorted(list(enumerate(distances)), reverse=True, key=lambda x:x[1])[1:10] - recommendations = [df.iloc[i[0]].title for i in movie_list] - return "\n".join(recommendations) - - -movie_input = gr.Textbox(label="Enter a movie title") -output_text = gr.Textbox(label="Recommendations") - - -iface = gr.Interface( fn=recommendation, inputs=movie_input, outputs=output_text , allow_flagging=False ) - -iface.launch() \ No newline at end of file diff --git a/spaces/avivdm1/AutoGPT/autogpt/speech/macos_tts.py b/spaces/avivdm1/AutoGPT/autogpt/speech/macos_tts.py deleted file mode 100644 index 4c072ce256782e83a578b5181abf1a7b524c621b..0000000000000000000000000000000000000000 --- a/spaces/avivdm1/AutoGPT/autogpt/speech/macos_tts.py +++ /dev/null @@ -1,21 +0,0 @@ -""" MacOS TTS Voice. """ -import os - -from autogpt.speech.base import VoiceBase - - -class MacOSTTS(VoiceBase): - """MacOS TTS Voice.""" - - def _setup(self) -> None: - pass - - def _speech(self, text: str, voice_index: int = 0) -> bool: - """Play the given text.""" - if voice_index == 0: - os.system(f'say "{text}"') - elif voice_index == 1: - os.system(f'say -v "Ava (Premium)" "{text}"') - else: - os.system(f'say -v Samantha "{text}"') - return True diff --git a/spaces/awacke1/AIZTH-03-09-2023/README.md b/spaces/awacke1/AIZTH-03-09-2023/README.md deleted file mode 100644 index 7949c7c5ce22c94ce42ca91cd39150dbff9ac918..0000000000000000000000000000000000000000 --- a/spaces/awacke1/AIZTH-03-09-2023/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 🔥AI Zero to Hero 3-9-2023🔥 -emoji: 🔥AIZTH -colorFrom: red -colorTo: blue -sdk: streamlit -sdk_version: 1.17.0 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/awsaf49/gcvit-tf/app.py b/spaces/awsaf49/gcvit-tf/app.py deleted file mode 100644 index ce5f7469dbe2a3b0ff1a7d709336b2af80993166..0000000000000000000000000000000000000000 --- a/spaces/awsaf49/gcvit-tf/app.py +++ /dev/null @@ -1,34 +0,0 @@ -import tensorflow as tf -import gradio as gr -import gcvit -from gcvit.utils import get_gradcam_model, get_gradcam_prediction - -def predict_fn(image, model_name): - """A predict function that will be invoked by gradio.""" - model = getattr(gcvit, model_name)(pretrain=True) - gradcam_model = get_gradcam_model(model) - preds, overlay = get_gradcam_prediction(image, gradcam_model, cmap='jet', alpha=0.4, pred_index=None) - preds = {x[1]:float(x[2]) for x in preds} - return [preds, overlay] - -demo = gr.Interface( - fn=predict_fn, - inputs=[ - gr.inputs.Image(label="Input Image"), - gr.Radio(['GCViTXXTiny', 'GCViTXTiny', 'GCViTTiny', - 'GCViTSmall', 'GCViTBase','GCViTLarge'], value='GCViTXXTiny', label='Model Name') - ], - outputs=[ - gr.outputs.Label(label="Prediction"), - gr.inputs.Image(label="GradCAM"), - ], - title="Global Context Vision Transformer (GCViT) Demo", - description="Image Classification with GCViT Model using ImageNet Pretrain Weights.", - examples=[ - ["example/hot_air_ballon.jpg", 'GCViTXXTiny'], - ["example/chelsea.png", 'GCViTXXTiny'], - ["example/penguin.JPG", 'GCViTXXTiny'], - ["example/bus.jpg", 'GCViTXXTiny'], - ], -) -demo.launch() \ No newline at end of file diff --git a/spaces/banana-projects/web3d/node_modules/three/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts b/spaces/banana-projects/web3d/node_modules/three/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts deleted file mode 100644 index b6408a1cedea053689a9967ddbf6bb56a9fc8181..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { - CubeTexture, - Renderer, - ShaderMaterial, - WebGLRenderTarget -} from '../../../src/Three'; - -export class PMREMCubeUVPacker { - CubeUVRenderTarget:WebGLRenderTarget; - - constructor(cubeTextureLods: CubeTexture[]); - update(renderer:Renderer): void; - dispose(): void; -} diff --git a/spaces/banana-projects/web3d/node_modules/three/src/loaders/TextureLoader.d.ts b/spaces/banana-projects/web3d/node_modules/three/src/loaders/TextureLoader.d.ts deleted file mode 100644 index 96e5703420f77d2a15e761b80733ee675dd29def..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/src/loaders/TextureLoader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LoadingManager } from './LoadingManager'; -import { Texture } from './../textures/Texture'; - -/** - * Class for loading a texture. - * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. - */ -export class TextureLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - crossOrigin: string; - withCredentials: string; - path: string; - - /** - * Begin loading from url - * - * @param url - */ - load( - url: string, - onLoad?: (texture: Texture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void - ): Texture; - setCrossOrigin(crossOrigin: string): TextureLoader; - setWithCredentials(value: string): TextureLoader; - setPath(path: string): TextureLoader; -} diff --git a/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js b/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js deleted file mode 100644 index 9bb6d738ae64b466be2367ebe21f24bfda137169..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +++ /dev/null @@ -1,7 +0,0 @@ -export default /* glsl */` -#ifdef USE_COLOR - - vColor.xyz = color.xyz; - -#endif -`; diff --git a/spaces/bastiendechamps/geoguessr-bot/geoguessr_bot/guessr/nearest_neighbor_embedder_guessr.py b/spaces/bastiendechamps/geoguessr-bot/geoguessr_bot/guessr/nearest_neighbor_embedder_guessr.py deleted file mode 100644 index 4fa57706f17b23496dfea18b0d161d4eee217a98..0000000000000000000000000000000000000000 --- a/spaces/bastiendechamps/geoguessr-bot/geoguessr_bot/guessr/nearest_neighbor_embedder_guessr.py +++ /dev/null @@ -1,43 +0,0 @@ -from dataclasses import dataclass - -from PIL import Image -import pandas as pd - -from geoguessr_bot.guessr import AbstractGuessr -from geoguessr_bot.interfaces import Coordinate -from geoguessr_bot.retriever import AbstractImageEmbedder -from geoguessr_bot.retriever import Retriever - - -@dataclass -class NearestNeighborEmbedderGuessr(AbstractGuessr): - """Guesses a coordinate using an Embedder and a retriever followed by NN. - """ - embedder: AbstractImageEmbedder - retriever: Retriever - metadata_path: str - - def __post_init__(self): - """Load metadata - """ - metadata = pd.read_csv(self.metadata_path) - self.image_to_coordinate = { - image.split("/")[-1]: Coordinate(latitude=latitude, longitude=longitude) - for image, latitude, longitude in zip(metadata["path"], metadata["latitude"], metadata["longitude"]) - } - - - def guess(self, image: Image) -> Coordinate: - """Guess a coordinate from an image - """ - # Embed image - image = Image.fromarray(image) - image_embedding = self.embedder.embed(image)[None, :] - - # Retrieve nearest neighbor - nearest_neighbors = self.retriever.retrieve(image_embedding) - nearest_neighbor = nearest_neighbors[0][0][0] - - # Guess coordinate - guess_coordinate = self.image_to_coordinate[nearest_neighbor] - return guess_coordinate diff --git a/spaces/bguberfain/Detic/tools/get_lvis_cat_info.py b/spaces/bguberfain/Detic/tools/get_lvis_cat_info.py deleted file mode 100644 index 83f286983ce811c4057ea8e8041e6a95dda78113..0000000000000000000000000000000000000000 --- a/spaces/bguberfain/Detic/tools/get_lvis_cat_info.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import argparse -import json - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument("--ann", default='datasets/lvis/lvis_v1_train.json') - parser.add_argument("--add_freq", action='store_true') - parser.add_argument("--r_thresh", type=int, default=10) - parser.add_argument("--c_thresh", type=int, default=100) - args = parser.parse_args() - - print('Loading', args.ann) - data = json.load(open(args.ann, 'r')) - cats = data['categories'] - image_count = {x['id']: set() for x in cats} - ann_count = {x['id']: 0 for x in cats} - for x in data['annotations']: - image_count[x['category_id']].add(x['image_id']) - ann_count[x['category_id']] += 1 - num_freqs = {x: 0 for x in ['r', 'f', 'c']} - for x in cats: - x['image_count'] = len(image_count[x['id']]) - x['instance_count'] = ann_count[x['id']] - if args.add_freq: - freq = 'f' - if x['image_count'] < args.c_thresh: - freq = 'c' - if x['image_count'] < args.r_thresh: - freq = 'r' - x['frequency'] = freq - num_freqs[freq] += 1 - print(cats) - image_counts = sorted([x['image_count'] for x in cats]) - # print('image count', image_counts) - # import pdb; pdb.set_trace() - if args.add_freq: - for x in ['r', 'c', 'f']: - print(x, num_freqs[x]) - out = cats # {'categories': cats} - out_path = args.ann[:-5] + '_cat_info.json' - print('Saving to', out_path) - json.dump(out, open(out_path, 'w')) - diff --git a/spaces/bhasker412/IDD-YOLO-Tracking/trackers/multi_tracker_zoo.py b/spaces/bhasker412/IDD-YOLO-Tracking/trackers/multi_tracker_zoo.py deleted file mode 100644 index 0a41973f77fb4e1dd1cf552f78f020e7f16c542c..0000000000000000000000000000000000000000 --- a/spaces/bhasker412/IDD-YOLO-Tracking/trackers/multi_tracker_zoo.py +++ /dev/null @@ -1,52 +0,0 @@ -from trackers.strongsort.utils.parser import get_config - - -def create_tracker(tracker_type, tracker_config, reid_weights, device, half): - - cfg = get_config() - cfg.merge_from_file(tracker_config) - - if tracker_type == 'strongsort': - from trackers.strongsort.strong_sort import StrongSORT - strongsort = StrongSORT( - reid_weights, - device, - half, - max_dist=cfg.strongsort.max_dist, - max_iou_dist=cfg.strongsort.max_iou_dist, - max_age=cfg.strongsort.max_age, - max_unmatched_preds=cfg.strongsort.max_unmatched_preds, - n_init=cfg.strongsort.n_init, - nn_budget=cfg.strongsort.nn_budget, - mc_lambda=cfg.strongsort.mc_lambda, - ema_alpha=cfg.strongsort.ema_alpha, - - ) - return strongsort - - elif tracker_type == 'ocsort': - from trackers.ocsort.ocsort import OCSort - ocsort = OCSort( - det_thresh=cfg.ocsort.det_thresh, - max_age=cfg.ocsort.max_age, - min_hits=cfg.ocsort.min_hits, - iou_threshold=cfg.ocsort.iou_thresh, - delta_t=cfg.ocsort.delta_t, - asso_func=cfg.ocsort.asso_func, - inertia=cfg.ocsort.inertia, - use_byte=cfg.ocsort.use_byte, - ) - return ocsort - - elif tracker_type == 'bytetrack': - from trackers.bytetrack.byte_tracker import BYTETracker - bytetracker = BYTETracker( - track_thresh=cfg.bytetrack.track_thresh, - match_thresh=cfg.bytetrack.match_thresh, - track_buffer=cfg.bytetrack.track_buffer, - frame_rate=cfg.bytetrack.frame_rate - ) - return bytetracker - else: - print('No such tracker') - exit() \ No newline at end of file diff --git a/spaces/bigjoker/stable-diffusion-webui/extensions-builtin/SwinIR/scripts/swinir_model.py b/spaces/bigjoker/stable-diffusion-webui/extensions-builtin/SwinIR/scripts/swinir_model.py deleted file mode 100644 index e8783bca153954afd086536a6dee854ec5e17ba9..0000000000000000000000000000000000000000 --- a/spaces/bigjoker/stable-diffusion-webui/extensions-builtin/SwinIR/scripts/swinir_model.py +++ /dev/null @@ -1,178 +0,0 @@ -import contextlib -import os - -import numpy as np -import torch -from PIL import Image -from basicsr.utils.download_util import load_file_from_url -from tqdm import tqdm - -from modules import modelloader, devices, script_callbacks, shared -from modules.shared import cmd_opts, opts, state -from swinir_model_arch import SwinIR as net -from swinir_model_arch_v2 import Swin2SR as net2 -from modules.upscaler import Upscaler, UpscalerData - - -device_swinir = devices.get_device_for('swinir') - - -class UpscalerSwinIR(Upscaler): - def __init__(self, dirname): - self.name = "SwinIR" - self.model_url = "https://github.com/JingyunLiang/SwinIR/releases/download/v0.0" \ - "/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR" \ - "-L_x4_GAN.pth " - self.model_name = "SwinIR 4x" - self.user_path = dirname - super().__init__() - scalers = [] - model_files = self.find_models(ext_filter=[".pt", ".pth"]) - for model in model_files: - if "http" in model: - name = self.model_name - else: - name = modelloader.friendly_name(model) - model_data = UpscalerData(name, model, self) - scalers.append(model_data) - self.scalers = scalers - - def do_upscale(self, img, model_file): - model = self.load_model(model_file) - if model is None: - return img - model = model.to(device_swinir, dtype=devices.dtype) - img = upscale(img, model) - try: - torch.cuda.empty_cache() - except: - pass - return img - - def load_model(self, path, scale=4): - if "http" in path: - dl_name = "%s%s" % (self.model_name.replace(" ", "_"), ".pth") - filename = load_file_from_url(url=path, model_dir=self.model_path, file_name=dl_name, progress=True) - else: - filename = path - if filename is None or not os.path.exists(filename): - return None - if filename.endswith(".v2.pth"): - model = net2( - upscale=scale, - in_chans=3, - img_size=64, - window_size=8, - img_range=1.0, - depths=[6, 6, 6, 6, 6, 6], - embed_dim=180, - num_heads=[6, 6, 6, 6, 6, 6], - mlp_ratio=2, - upsampler="nearest+conv", - resi_connection="1conv", - ) - params = None - else: - model = net( - upscale=scale, - in_chans=3, - img_size=64, - window_size=8, - img_range=1.0, - depths=[6, 6, 6, 6, 6, 6, 6, 6, 6], - embed_dim=240, - num_heads=[8, 8, 8, 8, 8, 8, 8, 8, 8], - mlp_ratio=2, - upsampler="nearest+conv", - resi_connection="3conv", - ) - params = "params_ema" - - pretrained_model = torch.load(filename) - if params is not None: - model.load_state_dict(pretrained_model[params], strict=True) - else: - model.load_state_dict(pretrained_model, strict=True) - return model - - -def upscale( - img, - model, - tile=None, - tile_overlap=None, - window_size=8, - scale=4, -): - tile = tile or opts.SWIN_tile - tile_overlap = tile_overlap or opts.SWIN_tile_overlap - - - img = np.array(img) - img = img[:, :, ::-1] - img = np.moveaxis(img, 2, 0) / 255 - img = torch.from_numpy(img).float() - img = img.unsqueeze(0).to(device_swinir, dtype=devices.dtype) - with torch.no_grad(), devices.autocast(): - _, _, h_old, w_old = img.size() - h_pad = (h_old // window_size + 1) * window_size - h_old - w_pad = (w_old // window_size + 1) * window_size - w_old - img = torch.cat([img, torch.flip(img, [2])], 2)[:, :, : h_old + h_pad, :] - img = torch.cat([img, torch.flip(img, [3])], 3)[:, :, :, : w_old + w_pad] - output = inference(img, model, tile, tile_overlap, window_size, scale) - output = output[..., : h_old * scale, : w_old * scale] - output = output.data.squeeze().float().cpu().clamp_(0, 1).numpy() - if output.ndim == 3: - output = np.transpose( - output[[2, 1, 0], :, :], (1, 2, 0) - ) # CHW-RGB to HCW-BGR - output = (output * 255.0).round().astype(np.uint8) # float32 to uint8 - return Image.fromarray(output, "RGB") - - -def inference(img, model, tile, tile_overlap, window_size, scale): - # test the image tile by tile - b, c, h, w = img.size() - tile = min(tile, h, w) - assert tile % window_size == 0, "tile size should be a multiple of window_size" - sf = scale - - stride = tile - tile_overlap - h_idx_list = list(range(0, h - tile, stride)) + [h - tile] - w_idx_list = list(range(0, w - tile, stride)) + [w - tile] - E = torch.zeros(b, c, h * sf, w * sf, dtype=devices.dtype, device=device_swinir).type_as(img) - W = torch.zeros_like(E, dtype=devices.dtype, device=device_swinir) - - with tqdm(total=len(h_idx_list) * len(w_idx_list), desc="SwinIR tiles") as pbar: - for h_idx in h_idx_list: - if state.interrupted or state.skipped: - break - - for w_idx in w_idx_list: - if state.interrupted or state.skipped: - break - - in_patch = img[..., h_idx: h_idx + tile, w_idx: w_idx + tile] - out_patch = model(in_patch) - out_patch_mask = torch.ones_like(out_patch) - - E[ - ..., h_idx * sf: (h_idx + tile) * sf, w_idx * sf: (w_idx + tile) * sf - ].add_(out_patch) - W[ - ..., h_idx * sf: (h_idx + tile) * sf, w_idx * sf: (w_idx + tile) * sf - ].add_(out_patch_mask) - pbar.update(1) - output = E.div_(W) - - return output - - -def on_ui_settings(): - import gradio as gr - - shared.opts.add_option("SWIN_tile", shared.OptionInfo(192, "Tile size for all SwinIR.", gr.Slider, {"minimum": 16, "maximum": 512, "step": 16}, section=('upscaling', "Upscaling"))) - shared.opts.add_option("SWIN_tile_overlap", shared.OptionInfo(8, "Tile overlap, in pixels for SwinIR. Low values = visible seam.", gr.Slider, {"minimum": 0, "maximum": 48, "step": 1}, section=('upscaling', "Upscaling"))) - - -script_callbacks.on_ui_settings(on_ui_settings) diff --git a/spaces/bioriAsaeru/text-to-voice/800 Bullets 2002 800 Balas LiMiTED DVDRip XviD QiX How a Boy Discovers His Grandfathers Wild West Show.md b/spaces/bioriAsaeru/text-to-voice/800 Bullets 2002 800 Balas LiMiTED DVDRip XviD QiX How a Boy Discovers His Grandfathers Wild West Show.md deleted file mode 100644 index d3cd861398111189c94bd07790a2572653a27656..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/800 Bullets 2002 800 Balas LiMiTED DVDRip XviD QiX How a Boy Discovers His Grandfathers Wild West Show.md +++ /dev/null @@ -1,6 +0,0 @@ -

800 Bullets 2002 800 Balas LiMiTED DVDRip XviD QiX


Download File >>> https://urloso.com/2uyPIJ



-
- aaccfb2cb3
-
-
-

diff --git a/spaces/bioriAsaeru/text-to-voice/Avantgarde Lt Book Font UPD Download.md b/spaces/bioriAsaeru/text-to-voice/Avantgarde Lt Book Font UPD Download.md deleted file mode 100644 index 34b9da8d7e03792ab37023afba756e3d9e9d3100..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/Avantgarde Lt Book Font UPD Download.md +++ /dev/null @@ -1,6 +0,0 @@ - -

Click to view font family "ITC Avant Garde LT".ITC Avant Garde LTITC Avant Garde LT Bold ItalicITC Avant Garde LT Extra BoldITC Avant Garde LT Extra Bold ItalicITC Avant Garde LT Extra LightITC Avant Garde LT Extra Light ItalicITC Avant Garde LT Italic