Saravanan666/pypi-org huggingface dataset:
Package: torchradio
TorchradioA differentiable RF simulation environment written in PyTorch.[!NOTE]torchradioisnotaffiliated with the official PyTorch project and should not be considered as a PyTorch-supported library liketorchvisionortorchaudio.Overviewtorchradioprovides an ecosystem for creating novel radios using machine learning. Specifically,torchradiolets engineers train parameterized radios with gradient-based methods usingPyTorch.torchradioaccomplishes this by modelling common RF effects with auto-differentiable blocks that allow gradients to backpropagate from an objective function.Why are gradients important?The gradient tells us in what direction we should adjust our parameters to immediately improve performance. Without this information, we can usually only improve performance via guess-and-check. That is, guess some new parameters, re-evaluate the objective function, and see whether performance improved. The gradient removes much of this guesswork by providing an explicit direction for the next parameter update. This information is critical when parameter space has thousands, millions, or even billions of dimensions.Gradients arenotessential for optimization. There exist many gradient-free optimization methods that do not require specialized simulation environments such astorchradio. Gradient-free methods allow users to optimize parameters with relatively simple techniques based on random search. Unfortunately these methods scale poorly as the number of parameters increases and are rarely used in conjunction with parameter-rich algorithms like deep neural networks (though there are some notable counter-examples such ashttps://arxiv.org/pdf/1703.03864.pdf).AssumptionsAll events take place at baseband.All devices have the same centre frequency and bandwidth.torchradiois not intended to replace a high-fidelity simulation. Rather, it is a training ground for developing novel radios. If a radio looks promising, its parameters can be exported for testing in a high-fidelity simulation environment.InstallationInstall thetorchradiopackage by running:pip install git+https://github.com/dewcservices/torchradio.gitContributingNew contributors are always welcome! If you would like to contribute, it is recommended you set up your development environment using the following instructions.Create a new Python virtual environment using your method of choice (e.g.,venv,conda,pyenvetc.). Clone this repository and install usingpip install -e .[dev]The above command will installtorchradioalong with its core dependencies, as well as dev-specific dependencies for formatting, linting and testing. The-eflag installstorchradioin editable mode, so you can quickly see the effects of local source code changes without reinstallingtorchradio. You can test that everything is working as expected by runningpytestTo save failing GitHub Actions due to styling issues, set up the project's git hooks using:pre-commit install
pre-commit run --all-filesYou can view the documentation locally anytime by running:mkdocs serve
Package: torchray
TorchRayTheTorchRaypackage implements several visualization methods for deep
convolutional neural networks using PyTorch. In this release, TorchRay focuses
onattribution, namely the problem of determining which part of the input,
usually an image, is responsible for the value computed by a neural network.TorchRayis research oriented: in addition to implementing well known
techniques form the literature, it provides code for reproducing results that
appear in several papers, in order to supportreproducible research.TorchRaywas initially developed to support the paper:Understanding deep networks via extremal perturbations and smooth masks.Fong, Patrick, Vedaldi.
Proceedings of the International Conference on Computer Vision (ICCV), 2019.ExamplesThe package contains several usage examples in theexamplessubdirectory.Here is a complete example for using GradCAM:fromtorchray.attribution.grad_camimportgrad_camfromtorchray.benchmarkimportget_example_data,plot_example# Obtain example data.model,x,category_id,_=get_example_data()# Grad-CAM backprop.saliency=grad_cam(model,x,category_id,saliency_layer='features.29')# Plots.plot_example(x,saliency,'grad-cam backprop',category_id)RequirementsTorchRay requires:Python 3.6 or greaterpytorch 1.1.0 or greatermatplotlibFor benchmarking, it also requires:torchvision 0.3.0 or greaterpycocotoolsmongodb (suggested)pymongod (suggested)On Linux/macOS, using conda you can installwhilereadrequirement;docondainstall\-cdefaults-cpytorch-cconda-forge--yes$requirement;done<<EOFpytorch>=1.1.0pycocotoolstorchvision>=0.3.0mongodbpymongoEOFInstalling TorchRayUsingpip:pipinstalltorchrayFrom source:pythonsetup.pyinstallorpipinstall.Full documentationThe full documentation can be foundhere.ChangesSee theCHANGELOG.Join the TorchRay communityWebsite:https://github.com/facebookresearch/TorchRaySee theCONTRIBUTINGfile for how to help out.The teamTorchRay has been primarily developed by Ruth C. Fong and Andrea Vedaldi.LicenseTorchRay is CC-BY-NC licensed, as found in theLICENSEfile.
Package: torchrbf
torchrbf: Radial Basis Function Interpolation in PyTorchThis is a PyTorch module forRadial Basis Function (RBF) Interpolation, which is translated fromSciPy's implemenation. This implementation benefits from GPU acceleration, making it significantly faster and more suitable for larger interpolation problems.Installationpip install torchrbfThe only dependencies are PyTorch and NumPy. If you want to run the tests and benchmarks, you also need SciPy installed.A note on numerical precisionIf you are using TF32, you may experience numerical precision issues. TF32 is enabled by default in PyTorch versions 1.7 to 1.11 (seehere). To disable it, you can usetorch.backends.cuda.matmul.allow_tf32=Falsetorchrbf will issue a warning if TF32 is enabled.UsageHere is a simple example for interpolating 3D data in a 2D domain:importtorchimportmatplotlib.pyplotaspltfromtorchrbfimportRBFInterpolatory=torch.rand(100,2)# Data coordinatesd=torch.rand(100,3)# Data vectors at each pointinterpolator=RBFInterpolator(y,d,smoothing=1.0,kernel='thin_plate_spline')# Query coordinates (100x100 grid of points)x=torch.linspace(0,1,100)y=torch.linspace(0,1,100)grid_points=torch.meshgrid(x,y,indexing='ij')grid_points=torch.stack(grid_points,dim=-1).reshape(-1,2)# Query RBF on grid pointsinterp_vals=interpolator(grid_points)# Plot the interpolated values in 2Dplt.scatter(grid_points[:,0],grid_points[:,1],c=interp_vals[:,0])plt.title('Interpolated values in 2D')plt.show()Performance versus SciPySince the module is implemented in PyTorch, it benefits from GPU acceleration. For larger interpolation problems, torchrbf is significantly faster than SciPy's implementation (+100x faster on a RTX 3090):
Package: torch-rc
TorchRCAn organized collection of Reservoir Computing models and techniques that is well-integrated within the PyTorch API.WARNING: Work in progress!What's insideModelsOptimizersInstallationExampleWhat's insideModelsAt the moment, the library contains an implementation of:(Leaky/Deep/Bidirectional)Echo State Network(torch_rc.nn.LeakyESN)(Leaky/Deep/Bidirectional)Echo State Network with Ring or Multiring Reservoir(torch_rc.nn.MultiringESN)More models are coming.OptimizersTorchRC allows to train the reservoir models either in closed form or with the standard PyTorch optimizers.
Exact incremental closed form techniques are supported in order to support those scenarios in which it is not feasible to hold all the network states in memory.
Training on the GPU is also supported.Currently supported optimizers:Ridge Classification(torch_rc.optim.RidgeClassification): for training a readout in closed-form for classification problems.Ridge Regression(torch_rc.optim.RidgeRegression): for training a readout in closed-form for regression problems.Ridge Incremental Classification(torch_rc.optim.RidgeIncrementalClassification): for training a readout in closed-form for classification problems,
passing data in multiple separate calls (e.g., for when your collection of states does not fit in memory).Ridge Incremental Regression(torch_rc.optim.RidgeIncrementalRegression): for training a readout in closed-form for regression problems,
passing data in multiple separate calls (e.g., for when your collection of states does not fit in memory).Installationpip3 install torch-rcExampleYou can find example scripts in theexamples/folder.
Package: torch-rechub
Torch-RecHub中文Wiki站查看最新研发进度，认领感兴趣的研发任务，学习rechub模型复现心得，加入rechub共建者团队等点击链接安装#稳定版pipinstalltorch-rechub#最新版1.gitclonehttps://github.com/datawhalechina/torch-rechub.git2.cdtorch-rechub3.pythonsetup.pyinstall核心定位易用易拓展，聚焦复现业界实用的推荐模型，以及泛生态化的推荐场景主要特性scikit-learn风格易用的API（fit、predict），即插即用模型训练与模型定义解耦，易拓展，可针对不同类型的模型设置不同的训练机制接受pandas的DataFrame、Dict数据输入，上手成本低高度模块化，支持常见Layer，容易调用组装成新模型LR、MLP、FM、FFM、CINtarget-attention、self-attention、transformer支持常见排序模型WideDeep、DeepFM、DIN、DCN、xDeepFM等支持常见召回模型DSSM、YoutubeDNN、YoutubeDSSM、FacebookEBR、MIND等丰富的多任务学习支持SharedBottom、ESMM、MMOE、PLE、AITM等模型GradNorm、UWL、MetaBanlance等动态loss加权机制聚焦更生态化的推荐场景冷启动延迟反馈去偏支持丰富的训练机制对比学习蒸馏学习第三方高性能开源Trainer支持（Pytorch Lighting）更多模型正在开发中快速使用单任务排序fromtorch_rechub.models.rankingimportWideDeep,DeepFM,DINfromtorch_rechub.trainersimportCTRTrainerfromtorch_rechub.basic.utilsimportDataGeneratordg=DataGenerator(x,y)train_dataloader,val_dataloader,test_dataloader=dg.generate_dataloader()model=DeepFM(deep_features=deep_features,fm_features=fm_features,mlp_params={"dims":[256,128],"dropout":0.2,"activation":"relu"})ctr_trainer=CTRTrainer(model)ctr_trainer.fit(train_dataloader,val_dataloader)auc=ctr_trainer.evaluate(ctr_trainer.model,test_dataloader)多任务排序fromtorch_rechub.models.multi_taskimportSharedBottom,ESMM,MMOE,PLE,AITMfromtorch_rechub.trainersimportMTLTrainermodel=MMOE(features,task_types,n_expert=3,expert_params={"dims":[64,32,16]},tower_params_list=[{"dims":[8]},{"dims":[8]}])ctr_trainer=MTLTrainer(model)ctr_trainer.fit(train_dataloader,val_dataloader)auc=ctr_trainer.evaluate(ctr_trainer.model,test_dataloader)
Package: torchrecipes
torchrecipesThis library is currently under heavy development - if you have suggestions on the API or use-cases you'd like to be covered, please open an github issue or reach out. We'd love to hear about how you're usingtorchrecipes.torchrecipesis a prototype is built on top of PyTORCH and provides a set of reproduci-able, re-usable, ready-to-run RECIPES for training different types of models, across multiple domains, on PyTorch Lgihtning.It aims ro provide reproduci-able "applications" built on top of PyTorch with good performance and easy reproduciability. Because this project builds on the pytorch ecosystem and requires significant investment, we'd love to hear from and work with
early adopters to shape the design. Please reach out on the issue tracker
if you're interested in using this for your project.Whytorchrecipes?The primary goal of thetorchrecipesis to 10x ML development by providing standard blueprints to easily train production-ready ML models across environemnts (from local development to cluster deployment).RequirementsPyTorch Recipes (torchrecipes):python3 (3.8+)torchInstallationTODORelease# install torchrecipespipinstalltorchrecipesContributingWe welcome PRs! See theCONTRIBUTINGfile.Licensetorchrecipes is BSD licensed, as found in theLICENSEfile.
Package: torchrecorder
torchrecorderA small package to record execution graphs of neural networks in PyTorch.
The package uses hooks and thegrad_fnattribute to record information.This can be used to generate visualizations at different scope depths.Licensed under MIT License.
View documentation athttps://torchrecorder.readthedocs.io/InstallationRequirements:Python3.6+PyTorchv1.3 or greater (thecpuversion)TheGraphvizlibrary andgraphvizpython package.Install this package:$ pip install torchrecorderAcknowledgementsThis is inspired fromszagoruyko/pytorchviz.  This package
differs frompytorchvizas it provides rendering at multiple depths.Note that for rendering a network during training, you can use TensorBoard andtorch.utils.tensorboard.SummaryWriter.add_graph,
which records and renders to aprotobufin a single step.  The intended usage oftorchrecorderis for
presentation purposes.
Package: torch.redstone
torch.redstonePolyfills, common boilerplates and utilities -- A super light-weight library to boost development with PyTorch.Works on CPU & GPU, with any version of PyTorch.Disclaimer: The project is neither affiliated with nor endorsed by PyTorch.Installationtorch.redstoneis a pure python package and can be installed via:pipinstalltorch.redstoneDocumentationThe documentation is available at thegithub wiki.
Package: torchreg
torchregtorchreg is a tiny (~100 lines) PyTorch-based library for 2D and 3D image registration.UsageAffine Registration of two image tensors is done via:fromtorchregimportAffineRegistration# Load images as torch Tensorssmall_alice=...# Tensor with shape [1, 3 (color channel), 1024 (pixel), 1024 (pixel)]big_alice=...# Tensor with shape [1, 3 (color channel), 1024 (pixel), 1024 (pixel)]# Intialize AffineRegistrationreg=AffineRegistration(is_3d=False)# Run it!moved_alice=reg(small_alice,big_alice)FeaturesMultiresolution approach to save compute (per default 1/4 + 1/2 of original resolution for 500 + 100 iterations)reg=AffineRegistration(scales=(4,2),iterations=(500,100))Choosing which operations (translation, rotation, zoom, shear) to optimizereg=AffineRegistration(with_zoom=False,with_shear=False)Custom initial parametersreg=AffineRegistration(zoom=torch.Tensor([[1.5,2.]]))Custom dissimilarity functions and optimizersdefdice_loss(x1,x2):dim=[2,3,4]iflen(x2.shape)==5else[2,3]inter=torch.sum(x1*x2,dim=dim)union=torch.sum(x1+x2,dim=dim)return1-(2.*inter/union).mean()reg=AffineRegistration(dissimilairity_function=dice_loss,optimizer=torch.optim.Adam)CUDA support (NVIDIA GPU)moved_alice=reg(moving=big_alice.cuda(),static=small_alice.cuda())MPS support (Apple M1 or M2)moved_alice=reg(moving=big_alice.to('mps'),static=small_alice.to('mps'))After the registration is run, you can apply it to new images (coregistration)another_moved_alice=reg.transform(another_alice,shape=(256,256))with desired output shape.You can access the affineaffine=reg.get_affine()and the four parameters (translation, rotation, zoom, shear)translation=reg.parameters[0]rotation=reg.parameters[1]zoom=reg.parameters[2]shear=reg.parameters[3]InstallationpipinstalltorchregExamples/TutorialsThere are three example notebooks:examples/basics.ipynbshows the basics by using small cubes/squares as image dataexamples/images.ipynbshows how to register alice_big.jpg to alice_small.jpgexamples/mri.ipynbshows how to register MR images (Nifti files) including co-, parallel and multimodal registrationBackgroundIf you want to know how the core of this package works, readthe blog post!
Package: torchreid
Torchreid-Pip: Packaged version of TorchreidThis repo is a packaged version of theTorchreidalgorithm.Installationpip install torchreidOverview1. Importtorchreidimporttorchreid2. Load data managerdatamanager=torchreid.data.ImageDataManager(root="reid-data",sources="market1501",targets="market1501",height=256,width=128,batch_size_train=32,batch_size_test=100,transforms=["random_flip","random_crop"])3 Build model, optimizer and lr_schedulermodel=torchreid.models.build_model(name="resnet50",num_classes=datamanager.num_train_pids,loss="softmax",pretrained=True)model=model.cuda()optimizer=torchreid.optim.build_optimizer(model,optim="adam",lr=0.0003)scheduler=torchreid.optim.build_lr_scheduler(optimizer,lr_scheduler="single_step",stepsize=20)4. Build engineengine=torchreid.engine.ImageSoftmaxEngine(datamanager,model,optimizer=optimizer,scheduler=scheduler,label_smooth=True)5. Run training and testengine.run(save_dir="log/resnet50",max_epoch=60,eval_freq=10,print_freq=10,test_only=False)CitationIf you use this code or the models in your research, please give credit to the following papers:@article{torchreid,title={Torchreid: A Library for Deep Learning Person Re-Identification in Pytorch},author={Zhou, Kaiyang and Xiang, Tao},journal={arXiv preprint arXiv:1910.10093},year={2019}}@inproceedings{zhou2019osnet,title={Omni-Scale Feature Learning for Person Re-Identification},author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},booktitle={ICCV},year={2019}}@article{zhou2021osnet,title={Learning Generalisable Omni-Scale Representations for Person Re-Identification},author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},journal={TPAMI},year={2021}}
Package: torchrender
# TorchRenderA library for testing and debugging graphics algorithms with torch. Or just graphics, though that may be slow depending on the GPU.## ExamplesThe current best way to see how to use this library is by looking through the examples and tests.### Conways's Game of Life + Color![Running Example](https://thumbs.gfycat.com/GrotesqueComposedIndigobunting-size_restricted.gif)[This example](https://github.com/SimLeek/TorchRender/blob/master/examples/interactive_test_pixel_shader.py) adds interaction between colors of different pixels to Conway's game of life. This doesn't really require a pixel shader, and could be done on normal pytorch, but the scrolling I added after the video above demonstrates a very simple usage for a pixel shader:```pythondef conway(frame, coords, finished):...trans = np.zeros_like(coords)trans[0, ...] = np.ones(trans.shape[1:])frame[coords] = array[coords+trans]```Here, we're adding 1 to a dimensions of 'coords' which is a tensor holding the locations of each pixel and color. This shifts the entire image by one pixel. If we did something more complicated based on the values of the coordinates, we could add more complicated shaders, like barrel distortions.## Installationtorchrender is distributed on [PyPI](https://pypi.org) as a universalwheel and is available on Linux/macOS and Windows and supportsPython 3.5+ and PyPy.```bash$ pip install torchrender```## Licensetorchrender is distributed under the terms of the[MIT License](https://choosealicense.com/licenses/mit>).
Package: torch-resize-images
# Resize Images using PyTorchThis package allows resizing images from the command line using PyTorch.## DependenciesPython 3.4++gputil 1.4.0tqdm 4.59.0torchvision 0.9.0torch 1.8.0Pillow 2.7++## InstallationInstall torch-resize-images using pip:` pip installtorch-resize-images`## UsageGiven images in some<input_dir>, the following line first resizes and then center-crops all
images to the size 224x224.`torch-resize-r<input_dir>-o<output_dir>--width224--height224 `You can speed up processing by running multiple processes in parallel using the-nflag.
This defaults to 1 and is limited by your system memory.`torch-resize-r<input_dir>-o<output_dir>--width224--height224-n8 `## Example
![Alt text](./images/resize.png “Example File”)
Package: torch-resnet
torch-resnetUnified torch implementation of Resnets with or without pre-activation/width.This implementation propose Resnets both for small and "large" images (Cifar vs ImageNet)
and implements all the model used in the papers introducing the ResNets.
Additional models can easily be created using the default class ResNet or PreActResNet.
It is also possible to create your own block following the same model as those implemented.Install$pipinstalltorch-resnetGetting startedimporttorchimporttorch_resnetfromtorch_resnet.utilsimportcount_layermodel=torch_resnet.PreActResNet50()# Build a backbone Resnet50 with pre-activationmodel.set_head(nn.Linear(model.out_planes,10))# Set a final linear headcount_layers(model)# -> 54 (In the original paper they do not count shortcut/downsampling layers)out=model(torch.randn(1,3,224,224))ResultsWork in progressReferences[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition.https://arxiv.org/pdf/1512.03385[2] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Identity Mappings in Deep Residual Networks.https://arxiv.org/pdf/1603.05027[3] Sergey Zagoruyko, Nikos Komodakis
Wide Residual Networks.https://arxiv.org/pdf/1605.07146Build and Deploy$python-mbuild
$python-mtwineuploaddist/*
Package: torch-runner
Torch RunnerA minimal wrapper that removes some of the overhead code in training pytorch modelsNote: If you are looking for something more extensive, checkoutPytorch Lightning. This is mostly designed for my personal use.RequirementstorchtqdmInstallationpip install torch-runnerFeaturesseed all variablestext loggerearly stoppingsave hyperparametersweights & biasessupportExampleCheckout theexamplesfolder which contains a jupyter notebook to train a resnet50 using torch_runner.importtorchimporttorch_runnerasTclassmyTrainer(T.TrainerModule):defcalc_metric(self,preds,target):## Calc metrics such as accuracy etc.defloss_fct(self,preds,target):## Calc lossdeftrain_one_step(self,batch,batch_id):## Get batch data from dataloader and perform one updatedefvalid_one_step(self,batch,batch_id):## Perform validation stepconfig=T.TrainerConfig()model=myModel()optimizer=torch.optim.SGD(model.parameters(),lr=0.01)train_dataloader=## pytorch dataloaderval_dataloader=## pytorch dataloaderTrainer=myTrainer(model,optimizer,config)Trainer.fit(train_dataloader,val_dataloader,epochs=10)
Package: torch-runstats
pytorch_runstatsRunning/online statistics for PyTorch.torch_runstatsimplements memory-efficient online reductions on tensors.Notable features:Arbitrary sample shapes beyond single scalarsReduction over arbitrary dimensions of each sample"Batched"/"binned" reduction into multiple running tallies using a per-sample bin index.
This can be useful, for example, in accumulating statistics over samples by some kind of "type" index or for accumulating statistics per-graph in apytorch_geometric-likebatching scheme. (This feature is similar totorch_scatter.)Option to ignore NaN values with correct sample counting.Note:the implementations currently heavily uses in-place operations for peformance and memory efficiency. This probably doesn't play nice with the autograd engine — this is currently likely the wrong library for accumulating running statistics you want to backward through. (SeeTorchMetricsfor a possible alternative.)For more information, please seethe docs.Installtorch_runstatsrequires PyTorch.The library can be installed from PyPI:$pipinstalltorch_runstatsThe latest development version of the code can also be installed fromgit:$gitclonehttps://github.com/mir-group/pytorch_runstatsand install it by running$cdtorch_runstats/
$pipinstall.You can run the tests with$pytesttests/Licensepytorch_runstatsis distributed under anMIT license.