Saravanan666/pypi-org huggingface dataset:
Package: pytorch-adaptive-computation-time
pytorch-adaptive-computation-timeThis library implements PyTorch modules for recurrent neural networks that can learn to execute variable-time algorithms,
as presented inAdaptive Computation Time for Recurrent Neural Networks (Graves 2016).
These models can learn patterns requiring varying amounts of computation for a fixed-size input,
which is difficult or impossible for traditional neural networks.
The library aims to be clean, idiomatic, and extensible, offering a similar interface to PyTorch’s builtin recurrent modules.The main features are:A nearly drop-in replacement for torch.nn.RNN- and torch.nn.RNNCell-style RNNs, but with the power of variable computation time.A wrapper which adds adaptive computation time to any RNNCell.Data generators, configs, and training scripts to reproduce experiments from the paper.ExampleVanilla PyTorch GRU:rnn = torch.nn.GRU(64, 128, num_layers=2)
output, hidden = rnn(inputs, initial_hidden)GRU with adaptive computation time:rnn = models.AdaptiveGRU(64, 128, num_layers=2, time_penalty=1e-3)
output, hidden, ponder_cost = rnn(inputs, initial_hidden)DocumentationDocumentation ishosted on Read the Docs.BibTeXYou don’t need to cite this code, but if it helps you in your research and you’d like to:@misc{swope2020ACT,
  title   = "pytorch-adaptive-computation-time",
  author  = "Swope, Aidan",
  journal = "GitHub",
  year    = "2020",
  url     = "https://github.com/maxwells-daemons/pytorch-adaptive-computation-time"
}If you use the experiment code, please also considerciting PyTorch Lightning.
Package: pytorch-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-argus
Argus is a lightweight library for training neural networks in PyTorch.Documentationhttps://pytorch-argus.readthedocs.ioInstallationRequirements:torch>=1.1.0From pip:pipinstallpytorch-argusFrom source:pipinstall-Ugit+https://github.com/lRomul/argus.gitExampleSimple image classification example withcreate_modelfrompytorch-image-models:fromtorchvision.datasetsimportMNISTfromtorch.utils.dataimportDataLoaderfromtorchvision.transformsimportCompose,ToTensor,Normalizeimporttimmimportargusfromargus.callbacksimportMonitorCheckpoint,EarlyStopping,ReduceLROnPlateaudefget_data_loaders(batch_size):data_transform=Compose([ToTensor(),Normalize((0.1307,),(0.3081,))])train_mnist_dataset=MNIST(download=True,root="mnist_data",transform=data_transform,train=True)val_mnist_dataset=MNIST(download=False,root="mnist_data",transform=data_transform,train=False)train_loader=DataLoader(train_mnist_dataset,batch_size=batch_size,shuffle=True)val_loader=DataLoader(val_mnist_dataset,batch_size=batch_size*2,shuffle=False)returntrain_loader,val_loaderclassTimmModel(argus.Model):nn_module=timm.create_modelif__name__=="__main__":train_loader,val_loader=get_data_loaders(batch_size=256)params={'nn_module':{'model_name':'tf_efficientnet_b0_ns','pretrained':False,'num_classes':10,'in_chans':1,'drop_rate':0.2,'drop_path_rate':0.2},'optimizer':('Adam',{'lr':0.01}),'loss':'CrossEntropyLoss','device':'cuda'}model=TimmModel(params)callbacks=[MonitorCheckpoint(dir_path='mnist',monitor='val_accuracy',max_saves=3),EarlyStopping(monitor='val_accuracy',patience=9),ReduceLROnPlateau(monitor='val_accuracy',factor=0.5,patience=3)]model.fit(train_loader,val_loader=val_loader,num_epochs=50,metrics=['accuracy'],callbacks=callbacks,metrics_on_train=True)More examples you can findhere.Why this name, Argus?The library name is a reference to a planet from World of Warcraft.
Argus is the original homeworld of the eredar (a race of supremely talented magic-wielders), now located within the Twisting Nether.
It was once described as a utopian world whose inhabitants were both vastly intelligent and highly gifted in magic.
It has since been twisted by demonic, chaotic energies and became the stronghold and homeworld of the Burning Legion.
Package: pytorch-attention
This codebase is a PyTorch implementation of various attention mechanisms, CNNs, Vision Transformers and MLP-Like models.If it is helpful for your work, please⭐Updating...Attention mechanismsSqueeze-and-Excitation Networks (CVPR 2018)pdfCBAM: convolutional block attention module (ECCV 2018)pdfBam: Bottleneck attention module(BMVC 2018)pdfA2-nets: Double attention networks (NeurIPS 2018)pdfSrm : A style-based recalibration module for convolutional neural networks (ICCV 2019)pdfGcnet: Non-local networks meet squeeze-excitation networks and beyond (ICCVW 2019)pdfSelective Kernel Networks (CVPR 2019)pdfLinear Context Transform Block (AAAI 2020)pdfGated Channel Transformation for Visual Recognition (CVPR 2020)pdfEcanet: Efficient channel attention for deep convolutional neural networks (CVPR 2020)pdfRotate to Attend: Convolutional Triplet Attention Module (WACV 2021)pdfGaussian Context Transformer (CVPR 2021)pdfCoordinate Attention for Efficient Mobile Network Design (CVPR 2021)pdfSimAM: A Simple, Parameter-Free Attention Module for Convolutional Neural Networks (ICML 2021)pdfVision TransformersAn image is worth 16x16 words: Transformers for image recognition at scale (ICLR 2021)pdfXCiT: Cross-Covariance Image Transformer (NeurIPS 2021)pdfRethinking Spatial Dimensions of Vision Transformers (ICCV 2021)pdfCvT: Introducing Convolutions to Vision Transformers (ICCV 2021)pdfCMT: Convolutional Neural Networks Meet Vision Transformers (CVPR 2022)pdfMetaFormer is Actually What You Need for Vision (CVPR 2022)pdfMobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer (ICLR 2022)pdfDilateFormer: Multi-Scale Dilated Transformer for Visual Recognition (TMM 2023)pdfBViT: Broad Attention based Vision Transformer (TNNLS 2023)pdfConvolutional Neural Networks(CNNs)Network In Network (ICLR 2014)pdfDeep Residual Learning for Image Recognition (CVPR 2016)pdfWide Residual Networks (BMVC 2016)pdfDensely Connected Convolutional Networks (CVPR 2017)pdfDeep Pyramidal Residual Networks (CVPR 2017)pdfMobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications (CVPR 2017)pdfMobileNetV2: Inverted Residuals and Linear Bottlenecks (CVPR 2018)pdfSearching for MobileNetV3 (ICCV 2019)pdfRes2Net: A New Multi-scale Backbone Architecture (TPAMI 2019)pdfGhostNet: More Features from Cheap Operations (CVPR 2020)pdfA ConvNet for the 2020s (CVPR 2022)pdfMLP-Like ModelsMLP-Mixer: An all-MLP Architecture for Vision (NeurIPS 2021)pdfPay Attention to MLPs (NeurIPS 2021)pdfGlobal Filter Networks for Image Classification (NeurIPS 2021)pdfSparse MLP for Image Recognition: Is Self-Attention Really Necessary? (AAAI 2022)pdfDynaMixer: A Vision MLP Architecture with Dynamic Mixing (ICML 2022)pdfPatches Are All You Need? (TMLR 2022)pdfVision Permutator: A Permutable MLP-Like Architecture for Visual Recognition (TPAMI 2022)pdfCycleMLP: A MLP-like Architecture for Dense Prediction (ICLR 2022)pdf
Package: pytorch-boost
Deep Learning framework to accelerate the training of PyTorch models.Boost•Docs•Community•ContributePyTorch-Boost is a deep learning optimization library, offering a lightweight and user-friendly wrapper for custom CUDA functions. Designed to accelerate PyTorch model training and inference, PyTorch-Boost facilitates the application of high-precision and low-precision modalities— encompassing 32-bit, 16-bit, 8-bit, 4-bit, and mixed-precision training—across multiple GPUs or machines with its distributed training capabilities.For detailed usage, installation guidelines, and more, please refer to our comprehensive documentation.Install PyTorch-BoostSimple installation from PyPIpipinstallpytorch-boostOther installation optionsInstall with optional dependenciespipinstallpytorch-boost['extra']Condacondainstallpytorch-boost-cconda-forgeInstall stable versionpipinstallhttps://github.com/kswain55/pytorch-boost/archive/refs/heads/release/stable.zip-UInstall bleeding-edgepipinstallhttps://github.com/kswain55/pytorch-boost/archive/refs/heads/master.zip-UCompatibilitySupported Platform:LinuxSupported Hardware:NVIDIA Hopper, Ada, Ampere, Volta, and Turing architectureAMD CDNA 2/3 and RDNA 2/3Supported Software Layer:CUDA 11.8 - 12.2 (NVIDIA)ROCM 5.3 and HIP compilation tools (AMD)AcknowledgementsWe would like to thank Tim Dettmers for his workbitsandbytesand the team developingPyTorch, allowing us to make this possible. We would also like to thank NVIDIA and AMD for providng the neccessary hardware for testing.How to cite usIf you found this library useful, please consider citing our work:@article{boost2023pytorch,title={Boost},author={minyoung huh, kswain},journal={arXiv preprint arXiv:2023.2023},year={2023}}
Package: pytorch-categorical
Fast Sampling from Categorical Distributions on the GPU using PyTorchCurrently, thepytorch.distributions.Categoricalis a bit slow if you
need to draw a large number of samples from a static categorical distribution.
Also, you are limited to having no more than 2^24 different outcomes.The"alias method"let's you sample very quickly from distributions with large support, and this
implementation in PyTorch let's you have more than 2^24 outcomes.I needed this for rapid generation of word embeddings inhilbert.Installpip install pytorch-categoricalUseimport pytorch_categorical
import torch

num_outcomes = int(1e6)
probs = torch.random(num_outcomes)
probs /= probs.sum()

sampler = pytorch_categorical.Categorical(probs)

num_samples = int(1e6)
samples = sampler.sample((num_samples,))The constructor also takes adtypeand adeviceif you want to specify
them.  By defaultPosterityAt the time I made this, there was an open issue to incorporate a more rapid
sampler based on the alias method, but nothing was released yet.  Hopefully
that will get into a release soon!  For now, use this!Tested.  It's Correct and Fast.I've backed this by a few simple tests, including a benchmark against torch.
This implementation takes about 175X longer to construct a sampler with one
million outcomes, but after this up-front cost, it yields (draws of ten
thousand) samples about 3000X faster (with greater advantage the more samples
that are eventually drawn).  So the main usecase is when you have to draw many
samples from a stable distribution.Run the correctness and benchmark tests:python test.py.Enjoy!
Package: pytorch-check
pytorch-checkCheck PyTorch models for (overtly) unsafe codeDepends on fickling, the Python pickling decompiler and static analyzer.By default, this checks for common patterns used to inject malicious code
into Python bytecode, but is not a 100% guarantee against any malicious
code embedded into models.The -t flag can be used to safely trace the execution of the bytecode to
see what's actually going on, and the -d flag can be used to print the
disassembled bytecode, for manual analysis.This script handles the TorchScript serialization format that is used for
PyTorch models (generally using the .pt or .pth extension), since that is
not handled directly by the CLI tool that comes with the fickling package.The format is defined here:https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/docs/serialization.mdBasically .pkl/.debug_pkl files are embedded into a Zip archive along with
data files as well as optional Python source code.For those of you who are unaware, pkl is serialized Python bytecode, that
is executed when the model is loaded, allowing for execution of arbitrary
code. Trojanizing PyTorch model files is trivial, including by using the
fickling tool by TrailOfBits to inject code into one of the embedded .pkl
or .debug_pkl files in a model.Install with:python3-mpipinstall--userpytorch-checkOr from this directory:python3-mpipinstall--user.Then use the command line tool like this:pytorch-check/path/to/file-or-directory...This will scan all of the specified files, treating .pkl/.pickle as files
containing pickled Python bytecode directly, and any other files like they
are PyTorch model files (i.e. Zip archives with embedded .pkl files).If a directory is specified, it will be scanned for files with the .ckpt,
.pt, .pth, .pkl or .pickle file extensions where the .ckpt, .pt and .pth
file extensions will be treated as PyTorch model files.Note that the pickled code embedded into PyTorch model files in general will
have some embedded imports from the pytorch package itself. This will emit a
warning since it's technically executing code, but is generally benign. Read
the warnings to see what is actually going on.Stay safe!
Package: pytorch-cinic
A simple package packaging a pytorch dataloader forthe CINIC10 dataset.If you use it cite the original authors@misc{https://doi.org/10.48550/arxiv.1810.03505,
  doi = {10.48550/ARXIV.1810.03505},
  url = {https://arxiv.org/abs/1810.03505},
  author = {Darlow, Luke N. and Crowley, Elliot J. and Antoniou, Antreas and Storkey, Amos J.},
  keywords = {Computer Vision and Pattern Recognition (cs.CV), Machine Learning (cs.LG), Machine Learning (stat.ML), FOS: Computer and information sciences, FOS: Computer and information sciences},
  title = {CINIC-10 is not ImageNet or CIFAR-10},
  publisher = {arXiv},
  year = {2018},
  copyright = {Creative Commons Attribution Share Alike 4.0 International}
}and if you want to be nice, alsothis repo(although the code is borderline trivial so no hard feelings if not).To use simply importfrom pytorch_cinic.dataset import CINIC10and then use like CIFAR10 (except that we usepartition=train/valid/testinstead oftrain=True/False)
Package: pytorch-ckpt-manager
PyTorch Checkpoint ManagerA custom PyTorch checkpoint manager inspired byTensorFlow's CheckpointManager. Specify the necessary arguments in the constructor and then use theCheckpointManager.save()andCheckpointManager.load()methods to save/load models. Functionality is similar to that oftorch.save()andtorch.load().Example usageThe following is a simple convolutional network for demonstrating the checkpoint manager's functionality.Imports:# Neural network source: https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_a_general_checkpoint.htmlimporttorchimporttorch.nnasnnfromckpt_managerimportCheckpointManagerCreate the neural network and its optimizer:classNet(nn.Module):def__init__(self):super(Net,self).__init__()self.conv1=nn.Conv2d(3,6,5)self.pool=nn.MaxPool2d(2,2)self.conv2=nn.Conv2d(6,16,5)self.fc1=nn.Linear(16*5*5,120)self.fc2=nn.Linear(120,84)self.fc3=nn.Linear(84,10)defforward(self,x):x=self.pool(F.relu(self.conv1(x)))x=self.pool(F.relu(self.conv2(x)))x=x.view(-1,16*5*5)x=F.relu(self.fc1(x))x=F.relu(self.fc2(x))x=self.fc3(x)returnxnet=Net()optimizer=torch.optim.SGD(net.parameters(),lr=0.001,momentum=0.9)Create the CheckpointManager:manager=CheckpointManager(assets={'model':net.state_dict(),'optimizer':optimizer.state_dict()},directory='training_checkpoints',file_name='model',maximum=3,file_format='pt')Save the states to the directory specified in the constructor:manager.save()Load the states from the directory:load_data=manager.load()net.load_state_dict(load_data['model'])optimizer.load_state_dict(load_data['optimizer'])If there is nothing to load,netandoptimizerwon't be altered.
Package: pytorch-clip
pytorch_clip: Pytorch API to work with CLIP models.Install packagepipinstallpytorch_clipInstall the latest versionpipinstall--upgradegit+https://github.com/bes-dev/pytorch_clip.gitFeaturesSupports original CLIP models by OpenAI and ruCLIP model by SberAI.UsageSimple codeimporttorchfrompytorch_clipimportget_models_list,get_clip_modelprint(get_models_list())model,text_processor,image_processor=get_clip_model()
Package: pytorch-clip-guided-loss
pytorch_clip_guided_loss: Pytorch implementation of the CLIP guided loss for Text-To-Image, Image-To-Image, or Image-To-Text generation.A simple library that implements CLIP guided loss in PyTorch.Install packagepipinstallpytorch_clip_guided_lossInstall the latest versionpipinstall--upgradegit+https://github.com/bes-dev/pytorch_clip_guided_loss.gitFeaturesThe library supports multiple prompts (images or texts) as targets for optimization.The library automatically detects the language of the input text, and multilingual translate it via google translate.The library supports the original CLIP model by OpenAI and ruCLIP model by SberAI.UsageSimple codeimporttorchfrompytorch_clip_guided_lossimportget_clip_guided_lossloss_fn=get_clip_guided_loss(clip_type="ruclip",input_range=(-1,1)).eval().requires_grad_(False)# text promptloss_fn.add_prompt(text="text description of the what we would like to generate")# image promptloss_fn.add_prompt(image=torch.randn(1,3,224,224))# variablevar=torch.randn(1,3,224,224).requires_grad_(True)loss=loss_fn.image_loss(image=var)["loss"]loss.backward()print(var.grad)VQGAN-CLIPWe provide our tiny implementation of the VQGAN-CLIP pipeline for image generation as an example of the usage of our library.
To start using our implementation of the VQGAN-CLIP please follow bydocumentation.Zero-shot Object DetectionWe provide our tiny implementation of the object detector based on Selective Search region proposals and CLIP guided loss.
To start using our implementation of the ClipRCNN please follow bydocumentation.
Package: pytorch-clip-interrogator
pytorch_clip_interrogator: Image-To-Promt.Install packagepipinstallpytorch_clip_interrogatorInstall the latest versionpipinstall--upgradegit+https://github.com/bes-dev/pytorch_clip_interrogator.gitFeaturesFully compatible with models from Huggingface.Supports BLIP 1/2 model.Support batch processing.UsageSimple codeimporttorchimportrequestsfromPILimportImagefrompytorch_clip_interrogatorimportPromptEngineer# build pipelinepipe=PromptEngineer(blip_model="Salesforce/blip2-opt-2.7b",clip_model="openai/clip-vit-base-patch32",device="cuda",torch_dtype=torch.float16)# load imageimg_url='https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'image=Image.open(requests.get(img_url,stream=True).raw).convert('RGB')# generate captionprint(pipe(image))
Package: pytorch-cnn-trainer
PyTorch CNN TrainerTrain CNN for your taskA simple engine to fine tune CNNs fromtorchvisionandPytorch Image modelsfrom Ross Wightman.Why This Package ?It is very annoying to write training loop and training code for CNN training. Also to support all the training features it takes massive time.Usually we don't need distributed training and it is very uncomfortable to use argparse and get the job done.This simplifies the training. It provide you a powerfulengine.pywhich can do lot of training functionalities.
Also adataset.pyto load dataset in common scenarios.Note: -
Pytorch Trainer is not a distributed training script.It will work good for single GPU machine for Google Colab / Kaggle.But for distributed Training you can use the PyTorch Lightning Trainer (soon).It will train on multiple GPUs just the way lightning supports (soon).To installInstall torch and torchvision fromPyTorchRun the following in terminal.pip install -q git+git://github.com/oke-aditya/pytorch_cnn_trainer.gitOr from PyPI now !!pip install pytorch_cnn_trainerDocs: -I have provided some example of how to use this trainer in multiple scenarios. Please check examples folder.
Some examples that are provided.Fine Tune Torchvision models using fit().Fine Tune Torchvision models using train_step() and validation_step().Fine Tune Ross Wightman's models.Quantization Aware Training head only.Quantization Aware Training Fully.Mixed Precision TrainingTraining with Stochastic Weighted Average (SWA)LR Finder implementationFeatures: -Support PyTorch image models (timm) training and transfer learning.Quantization Aware training example.Early stopping with patience.Support torchvision models trainging and transfer learning.Support torchvision quantized models transfer learning.Support for Mixed Precision Training.L2 Norm Gradient Penalty.LR Finder Implementation.SWA Stochastic weighted Averaging support for training.Add Keras Like fit method.Sanity Check method.Hope this repo helps people to train models using transfer learning.If you like it do give * and tell people about it.
Package: pytorch-complex
pytorch-complexInstall it using pip:pip install pytorch-complexUsage:
Similar to PyTorch.
For using the Complex features of this library, just change the regular torch imports with torchcomplex imports.
For example:
import torchcomplex.nn as nn  instead of import torch.nn as nn
Then, simply nn.Conv2d for both torch and torchcomplex, for 2D ConvolutionCreditsIf you like this repository, please click on Star!If you use this package or benift from the codes of this repo, please cite the following in your publications:Soumick Chatterjee, Chompunuch Sarasaen, Alessandro Sciarra, Mario Breitkopf, Steffen Oeltze-Jafra, Andreas Nürnberger, Oliver Speck: Going beyond the image space: undersampled MRI reconstruction directly in the k-space using a complex valued residual neural network (ISMRM, May 2021)BibTeX entry:@inproceedings{mickISMRM21ksp,author={Chatterjee, Soumick and Sarasaen, Chompunuch and Sciarra, Alessandro and Breitkopf, Mario and Oeltze-Jafra, Steffen and Nürnberger, Andreas and                     Speck, Oliver},year={2021},month={05},pages={1757},title={Going beyond the image space: undersampled MRI reconstruction directly in the k-space using a complex valued residual neural network},booktitle={2021 ISMRM \& SMRT Annual Meeting \& Exhibition}}Thank you so much for your support.History0.1.1 (2023-06-16)modReLU implementation changedNew activation functions added: Hirose and modSigmoid0.1.0 (2022-11-06)Default behaviour of complex_weights has been changed to TrueBasic max and avg functional callers addedBug fix with the new pooling functionals0.0.8 (2020-12-08)Complex Weight Initializations added (Few basics and trabelsi_standard, trabelsi_independent)0.0.1 (2020-11-06)First release (of the package) on PyPI.torchcomplex.nn -> Convolutions, Linears, Dropout, Pooling, BatchNorm, Few ActicationsUntested first version, could be buggy0.0.0 (2020-11-06)First release (basic structure, not the actual package code) on PyPI.
Package: pytorch-concurrent-dataloader
PytorchConcurrentDataloaderMinimal version of theConcurrentDataloader repositorypublished to pip.Setuppip install pytorch-concurrent-dataloaderUsagereplacetorch.utils.data.DataLoaderwithpytorch_concurrent_dataloader.DataLoaderpass new parameters for concurrent dataloadingfrom pytorch_concurrent_dataloader import DataLoader
dataloader = DataLoader(
    # pass old parameters as usual
    dataset=..., 
    batch_size=...,
    num_workers=...,
    # pass new parameters
    num_fetch_workers=...,
)
Package: pytorchcrf
PyTorch CRF with N-best DecodingImplementation of Conditional Random Fields (CRF) in PyTorch 1.0. It supports top-N most probable paths decoding.The package is based onpytorch-crfwith only the following differencesMethod_viterbi_decodethat decodes the most probable path get optimized. Running time gets reduced to 50% or less with batch size 15+ and sequence length 20+The class now supports decoding top-N most probable paths through the implementation of the method_viterbi_decode_nbestRequirementsPython 3 (>= 3.6)PyTorch (>= 1.0)InstallationpipinstallpytorchcrfExamples>>>importtorch>>>frompytorchcrfimportCRF>>>num_tags=5# number of tags is 5>>>model=CRF(num_tags)>>>seq_length=3# maximum sequence length in a batch>>>batch_size=2# number of samples in the batch>>>emissions=torch.randn(seq_length,batch_size,num_tags)# Computing log likelihood>>>tags=torch.tensor([[2,3],[1,0],[3,4]],dtype=torch.long)# (seq_length, batch_size)>>>model(emissions,tags)# Decoding>>>model.decode(emissions)# decoding the best path>>>model.decode(emissions,nbest=3)# decoding the top 3 paths