Saravanan666/pypi-org huggingface dataset:
Package: torchaudio-augmentations
PyTorch Audio AugmentationsAudio data augmentations library for PyTorch for audio in the time-domain. The focus of this repository is to:Provide many audio transformations in an easy Python interface.Have a high test coverage.Easily control stochastic (sequential) audio transformations.Make every audio transformation differentiable with PyTorch'snn.Module.Optimise audio transformations for CPU and GPU.It supports stochastic transformations as used often in self-supervised, semi-supervised learning methods. One can apply a single stochastic augmentation or create as many stochastically transformed audio examples from a single interface.This package follows the conventions set out bytorchvisionandtorchaudio, with audio defined as a tensor of[channel, time], or a batched representation[batch, channel, time]. Each individual augmentation can be initialized on its own, or be wrapped around aRandomApplyinterface which will apply the augmentation with probabilityp.UsageWe can define a single or several audio augmentations, which are applied sequentially to an audio waveform.fromaudio_augmentationsimport*audio,sr=torchaudio.load("tests/classical.00002.wav")num_samples=sr*5transforms=[RandomResizedCrop(n_samples=num_samples),RandomApply([PolarityInversion()],p=0.8),RandomApply([Noise(min_snr=0.001,max_snr=0.005)],p=0.3),RandomApply([Gain()],p=0.2),HighLowPass(sample_rate=sr),# this augmentation will always be applied in this aumgentation chain!RandomApply([Delay(sample_rate=sr)],p=0.5),RandomApply([PitchShift(n_samples=num_samples,sample_rate=sr)],p=0.4),RandomApply([Reverb(sample_rate=sr)],p=0.3)]We can also define a stochastic augmentation on multiple transformations. The following will apply both polarity inversion and white noise with a probability of 80%, a gain of 20%, and delay and reverb with a probability of 50%:transforms=[RandomResizedCrop(n_samples=num_samples),RandomApply([PolarityInversion(),Noise(min_snr=0.001,max_snr=0.005)],p=0.8),RandomApply([Gain()],p=0.2),RandomApply([Delay(sample_rate=sr),Reverb(sample_rate=sr)],p=0.5)]We can return either one or many versions of the same audio example:transform=Compose(transforms=transforms)transformed_audio=transform(audio)>>transformed_audio.shape=[num_channels,num_samples]audio = torchaudio.load("testing/classical.00002.wav")
transform = ComposeMany(transforms=transforms, num_augmented_samples=4)
transformed_audio = transform(audio)
>> transformed_audio.shape = [4, num_channels, num_samples]Similar to thetorchvision.datasetsinterface, an instance of theComposeorComposeManyclass can be supplied totorchaudiodataloaders that accepttransform=.OptionalInstall WavAugment for reverberation / pitch shifting:pip install git+https://github.com/facebookresearch/WavAugmentCiteYou can cite this work with the following BibTeX:@misc{spijkervet_torchaudio_augmentations,
  doi = {10.5281/ZENODO.4748582},
  url = {https://zenodo.org/record/4748582},
  author = {Spijkervet,  Janne},
  title = {Spijkervet/torchaudio-augmentations},
  publisher = {Zenodo},
  year = {2021},
  copyright = {MIT License}
}
Package: torchaudio-filters
torchaudio-filtersHigh-pass and low-pass filters implemented as modules with torchaudio.This small package offers a simple API to implement basic butterworth filters in PyTorch modules.
Aims to maintain consistency with the PyTorch API (e.g. behaves similarly totorchaudio.transforms.Spectrogram) and usestorchaudio.functional.filtfiltunder the hood.Output has been verified to generally match thescipy.signaloutput up to1e-2units of
precision in testing.>>>fromtorchimportnn>>>fromtorchaudio_filtersimportLowPass,Pad>>>sample_rate=128# Hz>>>sample_secs=10>>>x=torch.rand(32,21,sample_rate*sample_secs)# batch_idx, channel_idx, timestep_idx# Add pre-processors to your models using Sequential# * Pad will pad input and unpad output# * LowPass will filter to the frequencies below a given cutoff>>>model=nn.Sequential(...Pad(...module=LowPass(sample_rate,70)# Low-pass filter...padlen=32,...)...encoder,...decoder,......,...)>>>y_hat=model(x)InstallationRequires a relatively recenttorchaudioto be installed (anything after2.0.0should be more
than okay), and also needsscipy.To install the latest stable version fromPyPi:pipinstalltorchaudio-filtersUsageThis package includes thetorch.nn.moduleobjectsLowPass,HighPass,BandPass,Notch, andPad. These all assume the final dimension represents time, and apply Butterworth filters in theirforwardmethods.Let's generate a simple example on a sinusoidal 256 Hz signal with frequencies 5, 10, and 20 Hz:>>>sample_rate=256# Hz>>>sample_secs=1.5# s>>>t=torch.arange(0,sample_secs,1/sample_rate)>>>freqs=[5,10,20]>>>x=sum(torch.sin(2*torch.pi*f*t)forfinfreqs)We can design low-pass and high-pass filters and call them as any other module:>>>lp=LowPass(15,sample_rate)>>>x_lp=lp(x)>>>hp=HighPass(15,sample_rate)>>>x_hp=hp(x)>>>notch=Notch(7,12,sample_rate)>>>x_notch=notch(x)>>>bp=BandPass(7,12,sample_rate)>>>x_bp=bp(x)Plotting these results:>>>fig,(ax1,ax2,ax3)=plt.subplots(3,1,sharex=True,figsize=(9.6,6))>>>ax1.plot(t,x)>>>ax1.set_title('Input signal')>>>ax2.plot(t,x_lp)>>>ax2.plot(t,x_hp)>>>ax2.set_title('LowPass / HighPass')>>>ax3.plot(t,x_notch)>>>ax3.plot(t,x_bp)>>>ax3.set_title('Notch / BandPass')To decrease the edge effect, a wrapper modulePadis also provided>>>filt=torch.nn.Sequential(hp,notch)>>>filt_pad=Pad(...filt,...padlen=128,...)>>>x_f=filt(x)>>>x_fpad=filt_pad(x)>>>fig,(ax1,ax2)=plt.subplots(2,1,sharex=True,figsize=(8,6))>>>ax1.plot(t,x)>>>ax1.set_title('Input signal')>>>ax2.plot(t,x_f)>>>ax2.plot(t,x_fpad)>>>ax2.set_title('Without pad / With pad')>>>plt.show()ContributingPull requests are most welcome! If there's any questions, open an issue so we can discuss further.Dependencies and environments are managed withpoetry. To get started developing for this package:$ git clone https://github.com/BlakeJC94/torchaudio_filters
$ cd torchaudio_filters
$ poetry install
$ pytestBranchmainshould be stable, all the latest changes will go onto thedevbranch before being released onmain.Code is tested withpytestCode is styled usingblackCode is linted withruff
Package: torchaug
Efficient vision data augmentations for CPU/GPU per-sample/batched data.Under active development, subject to API changeTorchaugIntroductionTorchaug is a data augmentation library for the Pytorch ecosystem. It is meant to deal efficiently with tensors that are either on CPU or GPU and either per-samples or on batches.It seeks to improve Torchvision performance that has been implemented over Pytorch and Pillow to, among other things, perform data augmentations. However, because it has been implemented first with per-sample CPU data augmentations in mind, it has several drawbacks to make it efficient:For data augmentations on GPU, some CPU/GPU synchronizations cannot be avoided.For data augmentations applied on batch, the randomness is sampled for the whole batch and not each sample.Torchaug removes these issues and is meant to be used complimentary with Torchvision. It follows the same nomenclature as Torchvision withfunctionalaugmentations andtransformsclass wrappers. It is split into two packages:transformsfor per-sample data augmentationsbatch_transfromsfor batched data augmentations.More details can be found in thedocumentation.To be sure to retrieve the same data augmentations as Torchvision, it has been tested on each of its components to match Torchvision outputs.How to useInstall a Pytorch >= 2.0 environment.Install Torchaug.pipinstalltorchaugImport data augmentations either fromtorchaug.transformsortorchaug.batch_transformspackages. To ease with handling multiple sequential augmentations, wrappers have been defined.fromtorchaug.transformsimport(ImageWrapper,RandomColorJitter,RandomGaussianBlur)fromtorchaug.batch_transformsimport(BatchImageWrapper,BatchRandomColorJitter,BatchRandomHorizontalFlip)transform=ImageWrapper([RandomColorJitter(...),RandomGaussianBlur(...)],)batch_transform=BatchImageWrapper([BatchRandomColorJitter(...),BatchRandomHorizontalFlip(...)],inplace=True)How to contributeFeel free to contribute to this library by making issues and/or pull requests. For each feature you implement, add tests to make sure it works. Also, make sure to update the documentation.LICENSEThis project is under the Apache license 2.0.
Package: torch-baidu-ctc
torch-baidu-ctcPytorch bindings for Baidu's Warp-CTC. These bindings were inspired bySeanNaren'sbut these include some bug fixes,
and offer some additional features.importtorchfromtorch_baidu_ctcimportctc_loss,CTCLoss# Activations. Shape T x N x D.# T -> max number of frames/timesteps# N -> minibatch size# D -> number of output labels (including the CTC blank)x=torch.rand(10,3,6)# Target labelsy=torch.tensor([# 1st sample1,1,2,5,2,# 2nd1,5,2,# 3rd4,4,2,3,],dtype=torch.int,)# Activations lengthsxs=torch.tensor([10,6,9],dtype=torch.int)# Target lengthsys=torch.tensor([5,3,4],dtype=torch.int)# By default, the costs (negative log-likelihood) of all samples are summed.# This is equivalent to:#   ctc_loss(x, y, xs, ys, average_frames=False, reduction="sum")loss1=ctc_loss(x,y,xs,ys)# You can also average the cost of each sample among the number of frames.# The averaged costs are then summed.loss2=ctc_loss(x,y,xs,ys,average_frames=True)# Instead of summing the costs of each sample, you can perform# other `reductions`: "none", "sum", or "mean"## Return an array with the loss of each individual samplelosses=ctc_loss(x,y,xs,ys,reduction="none")## Compute the mean of the individual lossesloss3=ctc_loss(x,y,xs,ys,reduction="mean")## First, normalize loss by number of frames, later average lossesloss4=ctc_loss(x,y,xs,ys,average_frames=True,reduction="mean")# Finally, there's also a nn.Module to use this loss.ctc=CTCLoss(average_frames=True,reduction="mean",blank=0)loss4_2=ctc(x,y,xs,ys)# Note: the `blank` option is also available for `ctc_loss`.# By default it is 0.RequirementsC++11 compiler (tested with GCC 4.9).Python: 2.7, 3.5, 3.6, 3.7 (tested with versions 2.7, 3.5 and 3.6).PyTorch>= 1.1.0 (tested with version 1.1.0).For GPU support:CUDA Toolkit.InstallationThe installation process should be pretty straightforward assuming that you
have correctly installed the required libraries and tools.The setup process compiles the package from source, and will compile with
CUDA support if this is available for PyTorch.From Pypi (recommended)pipinstalltorch-baidu-ctcFrom GitHubgitclone--recursivehttps://github.com/jpuigcerver/pytorch-baidu-ctc.gitcdpytorch-baidu-ctc
pythonsetup.pybuild
pythonsetup.pyinstallAVX512 related issuesSome compiling problems may arise when using CUDA and newer host compilers
with AVX512 instructions. Please, install GCC 4.9 and use it as the host
compiler for NVCC. You can simply set theCCandCXXenvironment variables
before the build/install commands:CC=gcc-4.9CXX=g++-4.9pipinstalltorch-baidu-ctcor (if you are using the GitHub source code):CC=gcc-4.9CXX=g++-4.9pythonsetup.pybuildTestingYou can test the library once installed usingunittest. In particular,
run the following commands:python-munittesttorch_baidu_ctc.testAll tests should pass (CUDA tests are only executed if supported).
Package: torchbearer-variational
[WIP] torchbearer.variationalA Variational Auto-Encoder library for PyTorch with torchbearerContentsAboutInstallationGoalsAboutTorchbearer.variational is a companion package totorchbearerwhich is intended to
re-implement state of the art models and practices relating to the world of Variational Auto-Encoders (VAEs). The goal
is to provide everything from useful abstractions to complete re-implementations of papers. This is in order to support
both research and teaching / learning regarding VAEs.InstallationTBCGoalsCurrently,variationalonly includes abstractions for simple VAEs and some accompaniments, the next steps are as follows:Construct some separate part of the docs for thevariationalcontentImplement a series of standard models with associated notes pages and example usagesImplement other divergences not in PyTorch such as MMD, Jensen-Shannon, etc.Implement and document tools for sampling the latent spaces of models and producing figuresImplement other dataloaders not in torchvision and add associated docs
Package: torchbio
Pytorch utilities for bioinformatics.Free software: MIT licenseInstallationpip install torchbioYou can also install the in-development version with:pip install https://github.com/dohlee/python-torchbio/archive/master.zipDocumentationhttps://python-torchbio.readthedocs.io/DevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.0.0 (2019-12-28)First release on PyPI.
Package: torchblaze
TorchBlazeLink to DocumentationA CLI-based python package that provides a suite of functionalities to perform end-to-end ML using PyTorch.The following are the set of functionalities provided by the tool:Flask-API Template: Set up the basic PyTorch project sturcture and an easily tweakable flask-RESTful API with a single CLI command. Deploying your ML models has never been so easy.Test ML API: Once you have set up your API, test all the API end-points to ensure you get the expected results before pushing your API to deployment.Dockerizing: A simplified, single-command, easy dockerization for your ML API.ML Model Test Suite: The package comes with a built-in test suite that evaluates your PyTorch models over a set of tests to look for any errors that otherwise might not be traceable easily.Here are the available list of commands:Setting-up the Template Project:foo@bar:~$torchblazegenerate_template--project_nameexampleBuilding Docker Image (Requires Docker Installed):First cd to the root project directory containing app.py file.foo@bar:~$torchblazegenerate_docker--image_nameexample_imageRun Docker Image (Requires Docker Installed):foo@bar:~$torchblazerun_docker--image_nameexamplePerforming API Tests:First cd to the root project directory containing app.py file.foo@bar:~$torchblazeapi_testsPerforming Model Testing:Import the mltests packageimporttorchblaze.mltestsasmlsThen use the variety of testing methods available in the mltests package. Run the following command to get the list of available methods.dir(mls)To check the documentation for any of the available tests, use the help method:help(mls.<method_name>)
Package: torchblocks
TorchBlocksA PyTorch-based toolkit for natural language processingRequirementstransformers>=4.1.1torch>=1.6.0TorchBlocks requires Python 3.6+. We recommend installing TorchBlocks in a Linux or OSX environment.InstallationRecommended (because of active development):gitclonehttps://github.com/lonePatient/TorchBlocks.gitcdTorchBlocks
pythonsetup.pyinstallTutorialsTutorial 1 (text classification):task_text_classification_cola.pyTutorial 2 (siamese similarity):task_siamese_similarity_afqmc.pyTutorial 3 (sequence labeling):task_sequence_labeling_ner_crf.pyTutorial 4 (sentence similarity):task_sentence_similarity_lcqmc.pyTutorial 5 (triple similarity):task_triple_similarity_epidemic.pyExample scripts for each task:TorchBlocks/examples/
Package: torchblocks-chen
TorchBlocksA PyTorch-based toolkit for natural language processingRequirementstransformers>=4.1.1torch>=1.6.0TorchBlocks requires Python 3.6+. We recommend installing TorchBlocks in a Linux or OSX environment.InstallationRecommended (because of active development):gitclonehttps://github.com/situqingyun/torchblocks-chen.gitcdTorchBlocks
pythonsetup.pyinstallTutorialsTutorial 1 (text classification):task_text_classification_cola.pyTutorial 2 (siamese similarity):task_siamese_similarity_afqmc.pyTutorial 3 (sequence labeling):task_sequence_labeling_ner_crf.pyTutorial 4 (sentence similarity):task_sentence_similarity_lcqmc.pyTutorial 5 (triple similarity):task_triple_similarity_epidemic.pyExample scripts for each task:TorchBlocks/examples/
Package: torch-btg
Bridging the Gap: Unifying the Training and Evaluation of Neural Network Binary ClassifiersA PyTorch implementation of Bridging the Gap (BtG) losses including F-beta (F1), Accuracy, and AUROC.Project Webpage:btg.yale.eduPDF PaperCitation:@inproceedings{tsoi2022bridging,
  title         = {Bridging the Gap: Unifying the Training and Evaluation of Neural Network Binary Classifiers},
  author        = {Tsoi, Nathan and Candon, Kate and Li, Deyuan and Milkessa, Yofti and V{\'a}zquez, Marynel},
  booktitle     = {Advances in Neural Information Processing Systems},
  year          = {2022}
}UsageInstall thetorch-btgpackage:pip install torch-btgUse the desired loss in your code, for example,F1-loss:from torch_btg.loss import f1_loss
...
criterion = fb_loss(beta=1.0)
...Accuracy loss:from torch_btg.loss import accuracy_loss
...
criterion = accuracy_loss()
...DevelopmentSetuppython -m pip install --user toxThen run tests with:tox
Package: torchcache
torchcacheEffortlessly cache PyTorch module outputs on-the-fly withtorchcache.Particularly useful for caching and serving the outputs of computationally expensive large, pre-trained PyTorch modules, such as vision transformers. Note that gradients will not flow through the cached outputs.FeaturesInstallationBasic usageAssumptionsContributionFeaturesCache PyTorch module outputs either in-memory or persistently to disk.Simple decorator-based interface for easy usage.Uses an MRU (most-recently-used) cache to limit memory/disk usageInstallationpipinstalltorchcacheBasic usageQuickly cache the output of your PyTorch module with a single decorator:fromtorchcacheimporttorchcache@torchcache()classMyModule(nn.Module):def__init__(self):super().__init__()self.linear=nn.Linear(10,10)defforward(self,x):# This output will be cachedreturnself.linear(x)See documentation attorchcache.readthedocs.iofor more examples.AssumptionsTo ensure seamless operation,torchcacheassumes the following:Your module is a subclass ofnn.Module.The module's forward method accepts any number of positional arguments with shapes(B, \*), whereBis the batch size and\*represents any number of dimensions. All tensors should be on the same device and have the same dtype.The forward method returns a single tensor of shape(B, \*).ContributionEnsure you have Python installed.Installpoetry.Runpoetry installto set up dependencies.Runpoetry run pre-commit installto install pre-commit hooks.Create a branch, make your changes, and open a pull request.
Package: torch-chop
pychopA python package for simulaing low precision floating point arithmeticUsing low precesion can gain extra speedup while resulting in less storage and energy cost.  The intention ofpychop, following the same function ofchopin Matlab provided by Nick higham, is to simulate the low precision formats based on single and double precisions, which is pravalent on modern machine.The supported rounding modes include:Round to nearest using round to even last bit to break ties
(the default).Round towards plus infinity (round up).Round towards minus infinity (round down).Round towards zero.Stochastic rounding - round to the next larger or next smaller
floating-point number with probability proportional to
the distance to those floating-point numbers.Stochastic rounding - round to the next larger or next smaller
floating-point number with equal probability.Subnormal numbers is supported, they are flushed to zero if it not considered (by settingsubnormalto 0).This package provides consistent APIs to the chop software by Nick higham as much as possible.  For the first four rounding mode,  with the same user-specific parameters,pychopgenerates exactly same result as that of the chop software. For stochastic rounding (rmodeas 5 and 6), both output same results if random numbers is given the same.The supported floating point formatsThe supported floating point arithmetic formats include:formatdescription'q43', 'fp8-e4m3'NVIDIA quarter precision (4 exponent bits, 3 significand (mantissa) bits)'q52', 'fp8-e5m2'NVIDIA quarter precision (5 exponent bits, 2 significand bits)'b', 'bfloat16'bfloat16'h', 'half', 'fp16'IEEE half precision (the default)'s', 'single', 'fp32'IEEE single precision'd', 'double', 'fp64'IEEE double precision'c', 'custom'custom formatInstallpychophas the only essential following dependency:numpy >=1.7.3torch (only fortorch-chop)To install the current current release via PIP use:Numpy backendTorch backendpip install pychoppip install torch-chopContributingWe welcome contributions in any form! Assistance with documentation is always welcome. To contribute, feel free to open an issue or please fork the project make your changes and submit a pull request. We will do our best to work through any issues and requests.References[1] Nicholas J. Higham and Srikara Pranesh, Simulating Low Precision Floating-Point Arithmetic, SIAM J. Sci. Comput., 2019.[2] IEEE Standard for Floating-Point Arithmetic, IEEE Std 754-2019 (revision of IEEE Std 754-2008), IEEE, 2019.[3] Intel Corporation, BFLOAT16---hardware numerics definition,  2018
Package: torchchronos
torchchronostorchchronosis an experimentalPyTorchandLightningcompatible library that provides easy and flexible access to various time-series datasets for classification and regression tasks. It also provides a simple and extensible transform API to preprocess data.
It is inspired by the much more complicatedtorchtime.InstallationYou can install torchchronos via pip:pip install torchchronosUsageDatasetstorchchronos currently provides access to several popular time-series datasets, including:UCR/UEA Time Series Classification Repository:torchchronos.datasets.UCRUEADatasetTime series as preprocessed in theTFC paper:torchchronos.datasets.TFCPretrainDataset(datasetsGestureandEMG)To use a dataset, you can simply import the corresponding dataset class and create an instance:fromtorchchronos.datasetsimportUCRUEADatasetfromtorchchronos.transformsimportPadFrontfromtorchchronos.downloadimportdownload_uea_ucrdownload_uea_ucr("ECG5000",Path(".cache/data"))dataset=UCRUEADataset('ECG5000',path=Path(".cache")/"data",transforms=PadFront(10))Data Modulestorchchronos also providesLightning compatibleDataModulesto make it easy to load and preprocess data. They support common use cases like (multi-)GPU training and train/test/val-splitting out of the box. For example:fromtorchchronos.lightningimportUCRUEADataModulefromtorchchronos.transformsimportPadFront,PadBackmodule=UCRUEAModule('ECG5000',split_ratio=(0.75,0.15),batch_size=32,transforms=Compose([PadFront(10),PadBack(10)]))Analogous the the datasets above, these dataloaders are supported as of now, wrapping the respective datasets:torchchronos.lightning.UCRUEADataModuletorchchronos.lightning.TFCPretrainDataModuleTransformstorchchronos provides a flexible transform API to preprocess time-series data. For example, to normalize a dataset, you can define a customTransformlike this:fromtorchchronos.transformsimportTransformclassNormalize(Transform):def__init__(self,mean=None,std=None):self.mean=meanself.std=stddeffit(self,data)->Self:self.mean=data.mean()self.std=data.std()returnselfdef__call__(self,data):return(data-self.mean)/self.stdKnown issuesThe datasetSpokenArabicDigitsdoes not seem to work due to a missmatch of TRAIN and TEST sizeThe datasetUrbanSounddoes not seem to work due to missing ts filesRoadmapThe following features are planned for future releases of torchchronos:Support for additional time-series datasets, including:Energy consumption datasetTraffic datasetPhysioNet Challenge 2012 (in-hospital mortality)PhysioNet Challenge 2019 (sepsis prediction) datasetsAdditional transform classes, including:ResamplingMissing value imputationIf you have any feature requests or suggestions, please open an issue on our GitHub page.