Saravanan666/pypi-org huggingface dataset:
Package: pytorch-inferno
TitlePyTorch INFERNODocumentation:https://gilesstrong.github.io/pytorch_inferno/This package provides a PyTorch implementation of INFERNO (de Castro and Dorigo, 2018), along with a minimal high-level wrapper for training and applying PyTorch models, and running statistical inference of parameters of interest in the presence of nuisance parameters. INFERNO is implemented in the form of a callback, allowing it to be dropped in and swapped out with heavy rewriting of code.For an overview of the package, a breakdown of the INFERNO algorithm, and an introduction to parameter inference in HEP, I have written a 5-post blog series:https://gilesstrong.github.io/website/statistics/hep/inferno/2020/12/04/inferno-1.htmlThe authors' Tensorflow 1 code may be found here:https://github.com/pablodecm/paper-infernoAnd Lukas Layer's Tenforflow 2 version may be found here:https://github.com/llayer/infernoUser installpip install pytorch_infernoDeveloper install[install torch>=1.7 according to CUDA version]
pip install nbdev fastcore numpy pandas fastprogress matplotlib>=3.0.0 seaborn scipy
git clone git@github.com:GilesStrong/pytorch_inferno.git
cd pytorch_inferno
pip install -e .
nbdev_install_git_hooksOverviewLibrary developed and testing innbsdirectory.Experiments run inexperimentsdirectory.Usenbdev_build_libto export code to library located inpytorch_inferno. This overwrites any changes inpytorch_inferno, i.e. only edit the notebooks.ResultsThis package has been tested against the paper problem and reproduces its results within uncertaintyReferenceIf you have used this implementation of INFERNO in your analysis work and wish to cite it, the preferred reference is:Giles C. Strong, pytorch_inferno, Zenodo (Mar. 2021),http://doi.org/10.5281/zenodo.4597140, Note: Please checkhttps://github.com/GilesStrong/pytorch_inferno/graphs/contributorsfor the full list of contributors@misc{giles_chatham_strong_2021_4597140,  
  author       = {Giles Chatham Strong},  
  title        = {LUMIN},  
  month        = mar,  
  year         = 2021,  
  note         = {{Please check https://github.com/GilesStrong/pytorch_inferno/graphs/contributors for the full list of contributors}},  
  doi          = {10.5281/zenodo.4597140},  
  url          = {https://doi.org/10.5281/zenodo.4597140}  
}The INFERNO algorithm should also be cited:@article{DECASTRO2019170,
    title = {INFERNO: Inference-Aware Neural Optimisation},
    journal = {Computer Physics Communications},
    volume = {244},
    pages = {170-179},
    year = {2019},
    issn = {0010-4655},
    doi = {https://doi.org/10.1016/j.cpc.2019.06.007},
    url = {https://www.sciencedirect.com/science/article/pii/S0010465519301948},
    author = {Pablo {de Castro} and Tommaso Dorigo},
}
Package: pytorchkeras
Pytorch KerasIt is keras like for the Pytorch.
For now, it has Fit and compile method and rest will be added later, it does not behave exactly like Keras, but we can make it so in the future.InstalltionRun the following to installpipinstallpytorchkeras==0.0.1UsagefromPytorchKerasimportPytorchKeras
Package: pytorch-kfp-components
PyTorch Kubeflow Pipeline ComponentsPyTorch Kubeflow Pipeline Components provides an SDK and a set of components that lets you build kubeflow pipelines using PyTorch. You can use the predefined components in this repository to build your pipeline using the Kubeflow Pipelines SDK.InstallationRequirementsPython >= 3.6
Kubeflow cluster setuo (on-prem or in any of the Clouds)Install latest releaseUse the following command to install PyTorch Pipeline Components from PyPI.pip install -U pytorch-kfp-componentsInstall from sourceUse the following commands to install PyTorch Kubeflow Pipeline Components from GitHub.git clone https://github.com/kubeflow/pipelines.git
pip install pipelines/components/PyTorch/pytorch_kfp_components/.Running the testsRun the following commandpip install tox
cd ./components/PyTorch/pytorch-kfp-components/
tox -rvve py38SamplesFor running the samples follow the instruction mentioned as belowSamples README.md
Package: pytorch-lamb
Implementation ofhttps://arxiv.org/abs/1904.00962for large batch, large learning rate training.The paper doesn't specify clamp values for ϕ, so I use 10.Bonus: TensorboardX logging (example below).Try the samplegit clone git@github.com:cybertronai/pytorch-lamb.git
cd pytorch-lamb
pip install -e .
python test_lamb.py
tensorboard --logdir=runsSample resultsAt--lr=.02, the Adam optimizer is unable to train.Red:python test_lamb.py --batch-size=512 --lr=.02 --wd=.01 --log-interval=30 --optimizer=adamBlue:python test_lamb.py --batch-size=512 --lr=.02 --wd=.01 --log-interval=30 --optimizer=lamb
Package: pytorch-land
PyTorch LandThis is a repository of select implementations of deep learning models usingpytorch.There is also my own mini-framework for model training
(which I call simplyNetworkTrainer), that ended up with
something very similar toignite,
created in order to reduce common boilerplating.
More flexible and intuitive than ignite, in my opinion :).More models to be added, and improvements onNetworkTraineris under way.Installationpip3installpytorch-landSeepypi pagefor package details.Implemented ModelsCNN architecturesResNet (2015) [paper] [code]Inception v.2 (2015) [paper] [code]MobileNet (2017) [paper] [code]GANsGAN (2014) [paper] [code]DCGAN (2015) [paper] [code]InfoGAN (2016) [paper] [code]f-GAN (2016) [paper] [code]UnrolledGAN (2016) [paper] [code] [train-examples]ACGAN (2016) [paper] [code] [train-examples]BEGAN (2017) [paper] [code & examples]CycleGAN (2017) [paper] [code & examples]AutoencodersStacked Denoising Autoencoders [paper] [code]Stacked Convolutional Denoising Autoencoders (2017) [paper] [code]RequirementsRequired packages are specified inrequirements.txtfile. The packages can be installed using the following command:pip3install-rrequirements.txtNotably, the codes are compatible withpytorch 0.4- working on withpytorch 1.1compatibility.NetworkTrainerDatasets
Package: pytorch-lantern
Lantern contains our process of bringing a project to fruition as
efficiently as possible. This is subject to change as we iterate and improve.
This package implements tools and missing features to help bridge the gap
between frameworks and libraries that we utilize.The main packages and tools that we build around are:pytorchpytorch-datastreamguildSee thedocumentationfor more information.Create new project with templateInstallcookiecutterandpoetry:pip install cookiecutter
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | pythonSetup project:cookiecutter https://github.com/aiwizo/pytorch-lantern-template.git
cd <new-project>
poetry installYou can now train the placeholder model and inspect the results:guild run prepare
guild run train
guild tensorboardUse lantern without templatesInstall lantern from pypi using pip or poetry:poetry add pytorch-lantern[training]pip install pytorch-lantern[training]
Package: pytorch-lifestream
PyTorch-LifeStreamor PTLS a library built uponPyTorchfor building embeddings on discrete event sequences using self-supervision. It can process terabyte-size volumes of raw events like game history events, clickstream data, purchase history or card transactions.It supports various methods of self-supervised training, adapted for event sequences:Contrastive Learning for Event Sequences (CoLES)Contrastive Predictive Coding (CPC)Replaced Token Detection (RTD) fromELECTRANext Sequence Prediction (NSP) fromBERTSequences Order Prediction (SOP) fromALBERTMasked Language Model (MLM) fromROBERTAIt supports several types of encoders, including Transformer and RNN. It also supports many types of self-supervised losses.The following variants of the contrastive losses are supported:Contrastive loss (paper)Triplet loss (paper)Binomial deviance loss (paper)Histogramm loss (paper)Margin loss (paper)VICReg loss (paper)Install from PyPipipinstallpytorch-lifestreamInstall from source# Ubuntu 20.04sudoaptinstallpython3.8python3-venv
pip3installpipenv

pipenvsync--dev# install packages exactly as specified in Pipfile.lockpipenvshell
pytestDemo notebooksSupervised model trainingnotebookSelf-supervided training and embeddings for downstream tasknotebookSelf-supervided embeddings in CatBoostnotebookSelf-supervided training and fine-tuningnotebookSelf-supervised TrxEncoder only training with Masked Language Model task and fine-tuningnotebookPandas data preprocessing optionsnotebookPySpark and Parquet for data preprocessingnotebookFast inference on large datasetnotebookSupervised multilabel classificationnotebookText features demo:Using pretrained encoder to text featuresnotebookDocsDocumentationLibrary descriptionindexExperiments on public datasetspytorch-lifestreamusage experiments on several public event datasets are available in the separaterepoPyTorch-LifeStream in ML competitionsData Fusion Contest 2022 report(in Russian)Data Fusion Contest 2022 report, Sber AI Lab team(in Russian)VK.com Graph ML Hackaton report(in Russian)VK.com Graph ML Hackaton report, AlfaBank team(in Russian)American Express - Default Prediction Kaggle contest report(in Russian)How to contributeMake your chages via Fork and Pull request.Write unit test for new code inptls_tests.Check unit test viapytest:Example.
Package: pytorchlight
Pytorch LightPytorch Light is a Python package that provides several tools about modelling and applications.There are some features as follows:ModelDataLogVisualizationrequirements.txtis also provided.Next feature is going to be achieved as soon as possible.Adversarial LearningAnd some applications are coming:Computer VisionNatural LanguageRereinforcement LearningNotethat these features are only validated on cpu.ModelApplication for model.Features:trainevaluatebatch loss and batch metricmodel wrapperDataApplication for data.Features:Numpy.ndarray to/from Torch.tensorNumpy.ndarray to/from Torch.DatasetNumpy.ndarray to/from Torch.DataLoaderLogApplication for log.Features:debuginfowarnerrorcriticalVisualizationApplication for visualization based on numpy.ndarray.Require:In the notebook mode,%matplotlib inlineshould be implement first.Features:learning curvesbatch curvesone or multi images
Package: pytorch-lightning-applications
PyTorch Lightning Applications以 PyTorch Lightning 實作的機器學習與深度學習應用。本地開發載下 repo：exportREPO=pytorch_lightning_applications
gitclonehttps://github.com/leemengtaiwan/$REPO.gitcd$REPO建立新的Anaconda環境並安裝函式庫：condacreate-n$REPOpython=3.6-y
condaactivate$REPOpipinstall-rrequirements.txt設置nbdev環境並以可修改的方式安裝此 package：nbdev_install_git_hooks
nbdev_build_lib
pipinstall-e.
nbdev_build_docs
Package: pytorch-lightning-recipe
PyTorch Lightning Applications以 PyTorch Lightning 實作的機器學習與深度學習應用。本地開發載下 repo：exportREPO=pytorch_lightning_applications
gitclonehttps://github.com/leemengtaiwan/$REPO.gitcd$REPO建立新的Anaconda環境並安裝函式庫：condacreate-n$REPOpython=3.6-y
condaactivate$REPOpipinstall-rrequirements.txt設置nbdev環境並以可修改的方式安裝此 package：nbdev_install_git_hooks
nbdev_build_lib
pipinstall-e.
nbdev_build_docs
Package: pytorch-lightning-spells
PyTorch Lightning SpellsSome useful plugins forPyTorch Lightning.DocumentationIMPORTANT NOTICE: There is ongoing work to make this package fully compatible with PyTorch Lightning version 1.5+ and torchmetric version 0.8+. Please installversion 0.0.5if you are working with PyTorch Lightning version 1.3 or 1.4.Installationpipinstallpytorch-lightning-spellsor the latest in the main branch:pipinstallhttps://github.com/veritable-tech/pytorch-lightning-spells/archive/master.zip
Package: pytorch-logit-logic
A pytorch extension which provides functions and classes for logit-space operators
equivalent to probabilistic Boolean logic-gates AND, OR, and XNOR for independent probabilities.This provides the activation functions used in our paper:SC Lowe, R Earle, J d’Eon, T Trappenberg, S Oore (2022). Logical Activation Functions: Logit-space equivalents of Probabilistic Boolean Operators. InAdvances in Neural Information Processing Systems, volume 36.
doi:10.48550/arxiv.2110.11940.For your convenience, we provide a copy of this citation inbibtexformat.Example usage:frompytorch_logit_logicimportactfun_name2factoryfromtorchimportnnclassMLP(nn.Module):"""
    A multi-layer perceptron which supports higher-dimensional activations.

    Parameters
    ----------
    in_channels : int
        Number of input channels.
    out_channels : int
        Number of output channels.
    n_layer : int, default=1
        Number of hidden layers.
    hidden_width : int, optional
        Pre-activation width. Default: same as ``in_channels``.
        Note that the actual pre-act width used may differ by rounding to
        the nearest integer that is divisible by the activation function's
        divisor.
    actfun : str, default="ReLU"
        Name of activation function to use.
    actfun_k : int, optional
        Dimensionality of the activation function. Default is the lowest
        ``k`` that the activation function supports, i.e. ``1`` for regular
        1D activation functions like ReLU, and ``2`` for GLU, MaxOut, and
        NAIL_OR.
    """def__init__(self,in_channels,out_channels,n_layer=1,hidden_width=None,actfun="ReLU",actfun_k=None,):super().__init__()# Create a factory that generates objects that perform this activationactfun_factory=actfun_name2factory(actfun,k=actfun_k)# Get the divisor and space reduction factors for this activation# function. The pre-act needs to be divisible by the divisor, and# the activation will change the channel dimension by feature_factor._actfun=actfun_factory()divisor=getattr(_actfun,"k",1)feature_factor=getattr(_actfun,"feature_factor",1)ifhidden_widthisNone:hidden_width=in_channels# Ensure the hidden width is divisible by the divisorhidden_width=int(int(round(hidden_width/divisor))*divisor)layers=[]n_current=in_channelsfori_layerinrange(0,n_layer):layer=[]layer.append(nn.Linear(n_current,hidden_width))n_current=hidden_widthlayer.append(actfun_factory())n_current=int(round(n_current*feature_factor))layers.append(nn.Sequential(*layer))self.layers=nn.Sequential(*layers)self.classifier=nn.Linear(n_current,out_channels)defforward(self,x):x=self.layers(x)x=self.classifier(x)returnxmodel=MLP(in_channels=512,out_channels=10,n_layer=2,actfun="nail_or",)
Package: pytorch-lognormal-mixture
Intensity-Free Learning of Temporal Point ProcessesPip installable version of the pytorch lognormal mixture distribution from the paper"Intensity-Free Learning of Temporal Point Processes", Oleksandr
Shchur, Marin Biloš and Stephan Günnemann, ICLR 2020.Requirementspytorch>=1.2.0CitePlease cite the original author's paper if you use this code in your own work@article{
    shchur2020intensity,
    title={Intensity-Free Learning of Temporal Point Processes},
    author={Oleksandr Shchur and Marin Bilo\v{s} and Stephan G\"{u}nnemann},
    journal={International Conference on Learning Representations (ICLR)},
    year={2020},
}
Package: pytorchLosses
Install to usepip install pytorchLossesExamplesfrom pytorchLosses import  LabelSmoothingCrossEntropy,GamblersLoss,SCELoss,TruncatedLoss,FocalCosineLoss

a = torch.rand(4, 5)
b = torch.randint(0, 2, (4,))

loss_fun = LabelSmoothingCrossEntropy() 
print(loss_fun(a,b))
print(GamblersLoss(a,b))

loss_fun = SCELoss(alpha=1.0,beta=1.0,num_classes=5).cuda()
print(loss_fun(a.cuda(),b.cuda()))

# Yet to test
loss_fun = TruncatedLoss(q=0.7, k=0.5, trainset_size=10000).cuda()
print(loss_fun(a.cuda(),b.cuda(),indexes=1))

loss_fun = FocalCosineLoss(alpha=1.0, gamma=2.0,xent=0.1).cuda()
print(loss_fun(a.cuda(),b.cuda()))ExplanationLabel encodingLabel_encodingNeural net face 2 major error that are we usually told in every course and 1 major issue that is not famous which is called over confidence.Over confidenceconsider 100 examples within our dataset, each with predicted probability 0.9 by our model. If our model is calibrated, then 90 examples should be classified correctly. Similarly, among another 100 examples with predicted probabilities 0.6, we would expect only 60 examples being correctly classified. Copied formhere. Read full artical and if you like him love by applauding his work.
So basically convert [(0,1)] prediction to [(0.0333,0.9666)]Download to developpip install -e .[dev]
Package: pytorch-lr-finder
Pytorch Learning Rate FinderThis package can be used to find optimal learning rate.The package includesLearningRateFinderclass which implements thefit,find_optimal_lr method. Thefitmethod is used to find optimal learning rate within a range (optional)InstallationTo install with pip run the following commandpip install pytorch-lr-finderDependenciesThis package requires the following to be installed:Python 3.6 or higherPytorchNumpyPandasMatplotlibInstruction for usageLearningRateFindertakes instantiated pytorch model (nn.module), criterion and optimizer (torch.optim).Thefitmethod requires a dataloader (torch.utils.data.DataLoader), you can optionally include the number of steps, the starting and ending learning rate. Theplotfunction can be used to visualize the results in a plot. Please follow the example below for reference.lrf = LearningRateFinder(model, criterion, optimizer)
lrf.fit(train_loader)
lrf.plot()Example
Package: pytorch-lr-tuner
PyTorch Learning Rate TunerPython package to plot loss against varied learning rate for PyTorch neural network models and finding optimal learning rate for specific optimizer.Installation:pip install pytorch-lr-tunerDependency:Python 3.6NumpyPandasMatplotlibPyTorchExample:The package includesLearningRateFinderclass which can be instantiated with pytorch model reference, optimizer, criterion and training set. Thefit()method searches for optimal learning rate with multiplicative increment and smoothing with exponential weighted average and bias correction and the visualization of this log can be obtained through callingplot()method.from pytorch_lr_tuner import LearningRateFinder

ESTIMATOR_CONFIG = {'input_shape': 21, 'output_shape': 1, 'hidden_units': [32, 64, 16]}

binary_crossentropy = nn.BCELoss()

lr_finder = LearningRateFinder(estimator=VanillaNet, config=ESTIMATOR_CONFIG, optimizer='sgd', criterion=binary_crossentropy, train_set=train_set, val_set=val_set)

lr_finder.fit()
lr_finder.plot()Output:Here, the learning rate with steepest gradient in loss can be inferred as an optimal one for this specific architecture.
Package: pytorchltr
PyTorch Learning to Rank (LTR)This is a library for Learning to Rank (LTR) with PyTorch.
The goal of this library is to support the infrastructure necessary for performing LTR experiments in PyTorch.InstallationIn your virtualenv simply run:pip install pytorchltrNote that this library requires Python 3.5 or higher.DocumentationDocumentation is availablehere.ExampleSeeexamples/01-basic-usage.pyfor a more complete example including evaluationimporttorchfrompytorchltr.datasetsimportExample3frompytorchltr.lossimportPairwiseHingeLoss# Load datasettrain=Example3(split="train")collate_fn=train.collate_fn()# Setup model, optimizer and lossmodel=torch.nn.Linear(train[0].features.shape[1],1)optimizer=torch.optim.SGD(model.parameters(),lr=0.1)loss=PairwiseHingeLoss()# Train for 3 epochsforepochinrange(3):loader=torch.utils.data.DataLoader(train,batch_size=2,collate_fn=collate_fn)forbatchinloader:xs,ys,n=batch.features,batch.relevance,batch.nl=loss(model(xs),ys,n).mean()optimizer.zero_grad()l.backward()optimizer.step()Dataset DisclaimerThis library provides utilities to automatically download and prepare several public LTR datasets.
We cannot vouch for the quality, correctness or usefulness of these datasets.
We do not host or distribute these datasets and it is ultimatelyyour responsibilityto determine whether you have permission to use each dataset under its respective license.CitingIf you find this software useful for your research, we kindly ask you to cite the following publication:@inproceedings{jagerman2020accelerated,
    author = {Jagerman, Rolf and de Rijke, Maarten},
    title = {Accelerated Convergence for Counterfactual Learning to Rank},
    year = {2020},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval},
    doi = {10.1145/3397271.3401069},
    series = {SIGIR’20}
}
Package: pytorchltr2
PyTorch Learning to Rank (LTR)This is a library for Learning to Rank (LTR) with PyTorch.
The goal of this library is to support the infrastructure necessary for performing LTR experiments in PyTorch.This is a fork of the originalpytorchltr. It add fix and updates to allow it to work with Python >=3.10.InstallationIn your virtualenv simply run:pip install pytorchltr2Note that this library requires Python 3.10 or higher.DocumentationOriginal documentation is availablehere.ExampleSeeexamples/01-basic-usage.pyfor a more complete example including evaluationimporttorchfrompytorchltr.datasetsimportExample3frompytorchltr.lossimportPairwiseHingeLoss# Load datasettrain=Example3(split="train")collate_fn=train.collate_fn()# Setup model, optimizer and lossmodel=torch.nn.Linear(train[0].features.shape[1],1)optimizer=torch.optim.SGD(model.parameters(),lr=0.1)loss=PairwiseHingeLoss()# Train for 3 epochsforepochinrange(3):loader=torch.utils.data.DataLoader(train,batch_size=2,collate_fn=collate_fn)forbatchinloader:xs,ys,n=batch.features,batch.relevance,batch.nl=loss(model(xs),ys,n).mean()optimizer.zero_grad()l.backward()optimizer.step()Dataset DisclaimerThis library provides utilities to automatically download and prepare several public LTR datasets.
We cannot vouch for the quality, correctness or usefulness of these datasets.
We do not host or distribute these datasets and it is ultimatelyyour responsibilityto determine whether you have permission to use each dataset under its respective license.CitingIf you find this software useful for your research, please cite the publication for the original pytorchltr.@inproceedings{jagerman2020accelerated,
    author = {Jagerman, Rolf and de Rijke, Maarten},
    title = {Accelerated Convergence for Counterfactual Learning to Rank},
    year = {2020},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval},
    doi = {10.1145/3397271.3401069},
    series = {SIGIR’20}
}
Package: pytorch-mcrf
Masked CRFNOT OfficialPytorch implemented Masked CRF.InstallationDependenciesPython >= 3.6torch == 1.5.1 (better > 1.0)tqdm == 4.53.0pyyaml == 5.3.1Download and InstallEditable installation:pipinstall-e.Install from PyPI:pipinstallpytorch-mcrf-ihttps://pypi.org/simpleQuick StartSettingsAll the settings are inconfig.yaml, you can change model settings from this file.Runpythonrun.pyResultsMicro-F1 resultsWeiboNERBatch SizeOptimizerLearning RateMax Seqence Length8SGD0.015128MethodDevTest#Illegal TagsPlainCRF57.56451.7334MaskedCRF ( decoding only )55.66251.3510MaskedCRF55.38050.2870MSRABatch SizeOptimizerLearning RateMax Seqence Length8SGD0.015250Model is selected directly from test set since there is no official dev set.MethodTest#Illegal TagsPlainCRF86.2741MaskedCRF ( decoding only )86.2850MaskedCRF84.7140AcknowledgementsOfficial:MaskedCRFpytorch-crfallennlpChineseWeiboNERUPDATESv0.0.2: fix setuptools packages finding issue