Saravanan666/pypi-org huggingface dataset:
Package: torch-mimicry
Mimicry is a lightweight PyTorch library aimed towards the reproducibility of GAN research.Comparing GANs is often difficult - mild differences in implementations and evaluation methodologies can result in huge performance differences.
Mimicry aims to resolve this by providing:
(a) Standardized implementations of popular GANs that closely reproduce reported scores;
(b) Baseline scores of GANs trained and evaluated under the same conditions;
(c) A framework for researchers to focus on implementation of GANs without rewriting most of GAN training boilerplate code, with support for multiple GAN evaluation metrics.We provide a model zoo and set of baselines to benchmark different GANs of the same model size trained under the same conditions, using multiple metrics. To ensure reproducibility, we verify scores of our implemented models against reported scores in literature.
Package: torchminer
Published onpypiPackaged UsingPoetryDescriptionTorchMiner is designed to automatic process the training ,evaluating and testing process for PyTorch DeepLearning,with a
simple API.You can access all Functions of MineTorch simply useMiner.Quick StartimportTorchMinerfromTorchMinerimportMinerfromTorchMiner.plugins.Logger.JupyterimportJupyterLogger,JupyterTqdmfromTorchMiner.plugins.MetricsimportMultiClassesClassificationMetricfromTorchMiner.plugins.RecorderimportTensorboardDrawerminer=Miner(alchemy_directory='/the/route/to/log',train_dataloader=train_dataloader,val_dataloader=val_dataloader,model=model,loss_func=MSELoss,optimizer=optimizer,# or, by passing a function to optimizer, TorchMiner can auto cuda the params of optimizer# optimizer=lambda x: optim.SGD(x.parameters(), lr=0.01)，experiment="the-name-of-experiment",# Subdistribution in the experimental directoryresume=True,# Whether to automatically load the previous modeleval_epoch=1,# How many rounds are evaluatedpersist_epoch=2,# How many rounds are saved once a checkpointaccumulated_iter=1,# How many times iterates the parameter update after accumulationin_notebook=True,amp=True,# Whether to use ampplugins=[# Use the plugins to extend the function of minerJupyterLogger(),JupyterTqdm(),# or, you can use the below one to auto enable the above two# *JupyterEnvironmentAutoEnable(),# The two above plugins are designed to get better output in Jupyter EnviromentMultiClassesClassificationMetric(),# This Plugin can automaticly calculate Accuracy, kappa score and Confusion Matrix in Classification problems.TensorboardDrawer(input_to_model),# This Plugin can record the informations generate by training process or by other plugins in Tensorboard.],)# And then, trigger the training process byminer.train()
Package: torchmirror
PyTorch模型、数据集国内镜像一、使用方法只需要在使用模型或数据集之前导入torchmirror.dataset或torchmirror.model模块即可，如下：importtorchimporttorchvision.datasets.mnistasmnistfromtorchmirrorimportdataset,modeltrain_dataset=mnist.MNIST("./data",train=True,download=True)test_dataset=mnist.MNIST("./data",train=False,download=True)二、使用其他镜像要使用其他镜像，只需要修改PYTORCH_MODEL_MIRROR或PYTORCH_DATASET_MIRROR环境变量即可，如下：exportPYTORCH_MODEL_MIRROR=http://192.168.0.100:8080exportPYTORCH_DATASET_MIRROR=http://192.168.0.100:8080
Package: torchmix
torchmixThe missing component library for PyTorchtorchmixis a collection of pre-made PyTorch components designed to simplify model development process, primarily fortransformers. Our goal is to enable easy adoption of cutting-edge components with minimal code and maximum scalability.Note:torchmixis a prototype that is currently in development and has not been tested for production use. The API may change at any time.InstallTo usetorchmix, you will need to havetorchalready installed on your environment.pipinstalltorchmixDocumentationTo learn more, check out ourdocumentation.ContributingIf you have ideas for new components or ways to enhance the library, feel free to open an issue or start a discussion. We welcome all forms of feedback, including criticism and suggestions for significant design changes.Licensetorchmixis licensed under the MIT License.
Package: torchml
torchmlimplements the scikit-learn API on top of PyTorch.
This means we automatically get GPU support for scikit-learn and, when possible, differentiability.ResourcesGitHub:github.com/learnables/torchmlDocumentation:learnables.net/torchmlTutorials:learnables.net/torchml/tutorialsExamples:learnables.net/torchml/examplesGetting Startedpip install torchmlMinimal Linear Regression Exampleimporttorchmlasml(X_train,y_train),(X_test,y_test)=generate_data()# API closely follows scikit-learnlinreg=ml.linear_model.LinearRegression()linreg.fit(X_train,y_train)linreg.predict(X_test)ChangelogA human-readable changelog is available in theCHANGELOG.mdfile.CitingTo citetorchmlrepository in your academic publications, please use the following reference.Sébastien M. R. Arnold, Lucy Xiaoyang Shi, Xinran Gao, Zhiheng Zhang, and Bairen Chen. 2023. "torchml: a scikit-learn implementation on top of PyTorch".You can also use the following Bibtex entry:@misc{torchml,author={Arnold, S{\'e}bastien M R and Shi, Lucy Xiaoyang and Gao, Xinran and Zhang, Zhiheng and Chen, Bairen},title={torchml: A scikit-learn implementation on top of PyTorch},year={2023},url={https://github.com/learnables/torchml},}
Package: torchmo
Torch-Module-ObserverTorch-Module-Observer is a tool that uses the internal torch hook functionnalities to provide an API to observe on a model'snn.Modules.Here is an example with a ConvObserver, but this tool can be used toobserve any module, not only Convs.Extract features :First layer-------------->Last layerInstallationpipinstalltorchmoThis package also works with conda and poetry.UsefromtorchmoimportConvObservermodel=...# nn.Moduleobserver=ConvObserver(model)# Observe modelfeatures=observer(tensor_imgs)# Forward pass through the observer# After the forward pass, the observer stored the feature infoout_p=".cache"out_p.mkdir(exist_ok=True)# Save figuresobserver.save_figs(cache_p)# Iterate manually through conv featuresforname,outputinfeatures:# output is a batch of# output.shape (B,N,H,W)print(output.shape)breakCreate your ownAll you need to do is to inherit theModuleObserverclass.SeeConvObserverto see how to inherit and use.ContributeThe project is small and some peope may have other use cases.Poetry is being used to manage the environment.Feel free to open anissueand/or do a PR when you believe it would help the community.
Package: torchmocks
torchmocksTest pytorch code with minimal computational overhead.ProblemThe computational overhead of neural networks discourages thorough testing during development and within CI/CD pipelines.SolutionTorchmocks replaces common building blocks (such as torch.nn.Conv2d) with replicas that only keep track of tensor shapes and device location.  This is often the only information that we need to check to ensure proper function of pytorch code.Installpip install torchmocksExampleimporttorchimporttorchmocksfromtorchvision.modelsimportresnet152deftest_mock_resnet():net=resnet152()torchmocks.mock(net)image_batch=torch.zeros(4,3,255,255)output=net(image_batch)assertoutput.shape==(4,1000)Pytorch Lightning UsersYou can exercise most of your training code with torchmocks and the run_fast_dev option for Trainer.
See full examplehere.deftest_training():dataset=MockDataset()train_loader=torch.utils.data.DataLoader(dataset,batch_size=3)val_loader=torch.utils.data.DataLoader(dataset,batch_size=3)model=ExamplePytorchLightningModule()mock(model,debug=True)trainer=pytorch_lightning.Trainer(fast_dev_run=2)trainer.fit(model,train_loader,val_loader)StatusThis is a work in progress and only a handful of torch modules have been mocked. Modules that have not been mocked will run their normal computation during the forward pass.
I'm also exploring other ways to do shape inference in order to mock operations that don't appear in the module tree. Let me know if you have any ideas.
Package: torch-model
torch-modelKeras-like torch module wrapperTested with Torch 1.8.0Install$pipinstalltorch-modelUsagefromtorch_modelimportModelfromtorch_model.callbacksimportEarlyStoppingmodel=Model(MyPyTorchModule())model.compile(loss='mse',optimizer='adam',metrics=['mae','mape'])history=model.fit(train_ds,validation_data=val_ds,callbacks=[EarlyStopping(monitor='val_loss',patience=5)])# The original torch modulemodel.moduleLicenseMIT
Package: torch-model-archiver
Torch Model Archiver is a tool used for creating archives of trained neural net models that can be consumed by TorchServe for inference.Use the Torch Model Archiver CLI to create a.marfile.Torch Model Archiver is part ofTorchServe.
However, you can install Torch Model Archiver stand alone.Detailed documentation and examples are provided in theREADME.Installationpython -m pip install torch-model-archiverSource codeYou can check the latest source code as follows:git clone https://github.com/pytorch/serve.gitCitationIf you use torchserve in a publication or project, please cite torchserve:https://github.com/pytorch/serve
Package: torch-model-archiver-ag
Torch Model Archiver is a tool used for creating archives of trained neural net models that can be consumed for TorchServe inference.Use the Torch Model Archiver CLI to start create a.marfile.Torch Model Archiver is part ofTorchServe.
However, you can install Torch Model Archiver stand alone.Detailed documentation and examples are provided in theREADME.Installationpip install torch-model-archiverSource codeYou can check the latest source code as follows:git clone https://github.com/pytorch/serve.gitCitationIf you use torchserve in a publication or project, please cite torchserve:https://github.com/pytorch/serve
Package: torch-model-archiver-nightly
Torch Model Archiver is a tool used for creating archives of trained neural net models that can be consumed by TorchServe for inference.Use the Torch Model Archiver CLI to create a.marfile.Torch Model Archiver is part ofTorchServe.
However, you can install Torch Model Archiver stand alone.Detailed documentation and examples are provided in theREADME.Installationpython -m pip install torch-model-archiverSource codeYou can check the latest source code as follows:git clone https://github.com/pytorch/serve.gitCitationIf you use torchserve in a publication or project, please cite torchserve:https://github.com/pytorch/serve
Package: torch-model-state
torch-model-statePyTorch Model State Save & Load.InstallationNeed Python 3.6+.pipinstalltorch-model-stateUsagePython:importboximporttorch_model_statefromtorch.optimimportSGDconfig={'type':'MobileNetV2'# need install torch-basic-models}model=box.factory(config=config,tag='model')optimizer=SGD(model.parameters(),lr=0.1)state=torch_model_state.to_state(model=model,config=config,optimizers=[optimizer])torch_model_state.save_state_file(state=state,file_path='checkpoint.sf')state=torch_model_state.load_state_file(file_path='checkpoint.sf',device='cpu')torch_model_state.from_state(state,model,[optimizer],device='cpu')Load from State File (.sf) directly:importtorch_model_statemodel=torch_model_state.load_model_from_state(file_path='checkpoint.sf',device='cpu')CLI:# show helptorch-model-state-h#> usage: torch-model-state [-h] [--load_model] [--extra_import EXTRA_IMPORT]#>                          [--device DEVICE]#>                          state_file#>#> Viewer of PyTorch State File [.sf]#>#> positional arguments:#>   state_file            path of PyTorch state file#>#> optional arguments:#>   -h, --help            show this help message and exit#>   --load_model          load model and show#>   --extra_import EXTRA_IMPORT#>                         import extra models#>   --device DEVICE       load device, cpu in default# view basic info of state filetorch-model-statecheckpoint.sf#> {#>   "config": {#>     "type": "MobileNetV2"#>   },#>   "info": null,#>   "timestamp": "2019-04-27 22:42:55.345000"#> }# view & load Modeltorch-model-statecheckpoint.sf--load_model#> {#>   "config": {#>     "type": "MobileNetV2"#>   },#>   "info": null,#>   "timestamp": "2019-04-27 22:42:55.345000"#> }#> MobileNetV2(#>   (blocks): Sequential(#>     (0): Sequential(#>       (0): Conv2d(3, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)#>       (1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)#>       (2): InplaceReLU6(inplace)#>     )#>   ...# export to ONNXtorch-model-statecheckpoint.sf--export_onnxcheckpoint.onnx
Package: torchmojiartifact
torchmojiartifactBentoML artifact framework for the Torchmoji Model.Installation:pip install torchmojiartifact==0.0.1Usage example (decorate service):from torchmojiartifact.TorchmojiModelArtifact import TorchmojiModelArtifact

@artifacts([TorchmojiModelArtifact('emojify')])
class MyBentoService(BentoService):Usage example (package model):svc = MyBentoService()

svc.pack('emojify', model_path)Alternatively, during training:svc.pack('emojify', {'state_dict': my_state_dict, 'emoji_list': my_emoji_list, 'pax_list': my_pax_list, 'vocabulary': my_vocab})
Package: torch-mtcnn
The original work of this project is always belong to the original creator (https://github.com/TropComplique/mtcnn-pytorch). I just make this available on pypi for easy installation. To install this project just typepip install torch-mtcnnMTCNNpytorchimplementation ofinference stageof face detection algorithm described inJoint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks.ExampleHow to use itInstall the package with pip:pip install torch-mtcnnfromtorch_mtcnnimportdetect_facesfromPILimportImageimage=Image.open('image.jpg')bounding_boxes,landmarks=detect_faces(image)For a few more examples available on the original repository (link above).Requirementspytorch 0.2Pillow, numpyCreditThis implementation is heavily inspired by:pangyupo/mxnet_mtcnn_face_detection
Package: torch-multilabel-embedding
torch-multilabel-embeddingThe package contains a TensorFlow2/Keras class to train an Embedding
matrix for multi-label inputs, i.e. instead of 1 ID per token (one hot
encoding), N IDs per token can be provided as model input.An TensorFlow2/Keras implementation can be found here:https://github.com/ulf1/keras-multilabel-embedding(pip installkeras-multilabel-embedding)Usageimporttorch_multilabel_embeddingastmlimporttorch# a sequence of multi-label data pointsx_ids=[[1,2,4],[0,1,2],[2,1,4],[3,2,1]]x_ids=torch.tensor(x_ids)# initialize layerlayer=tml.MultiLabelEmbedding(vocab_size=5,embed_size=300,random_state=42)# predicty=layer(x_ids)AppendixInstallationThetorch-multilabel-embeddinggit
repois available
asPyPi
packagepipinstalltorch-multilabel-embeddingpipinstallgit+ssh://git@github.com/ulf1/torch-multilabel-embedding.gitInstall a virtual environmentpython3-mvenv.venvsource.venv/bin/activatepipinstall--upgradepippipinstall-rrequirements.txt--no-cache-dirpipinstall-rrequirements-dev.txt--no-cache-dirpipinstall-rrequirements-demo.txt--no-cache-dir(If your git repo is stored in a folder with whitespaces, then don’t use
the subfolder.venv. Use an absolute path without whitespaces.)Python commandsJupyter for the examples:jupyter labCheck syntax:flake8--ignore=F401--exclude=$(grep-v'^#'.gitignore | xargs | sed-e's//,/g')Run Unit Tests:PYTHONPATH=. pytestPublishpandocREADME.md--frommarkdown--torst-s-oREADME.rstpythonsetup.pysdisttwineupload-rpypidist/*Clean upfind.-typef-name"*.pyc"|xargsrmfind.-typed-name"__pycache__"|xargsrm-rrm-r.pytest_cacherm-r.venvSupportPleaseopen an
issuefor support.ContributingPlease contribute usingGithub
Flow. Create a branch,
add commits, andopen a pull
request.
Package: torchnca
torchncaA PyTorch implementation ofNeighbourhood Components AnalysisbyJ. Goldberger, G. Hinton, S. Roweis, R. Salakhutdinov.NCA learns a linear transformation of the dataset such that the expected leave-one-out performance of kNN in the transformed space is maximized.InstallationYou can install torchnca with pip:pip install torchncaAPIfromtorchncaimportNCA# instantiate torchnca object and initialize with# an identity matrixnca=NCA(dim=2,init="identity")# fit an torchnca model to a dataset# normalize the input data before# running the optimizationnca.train(X,y,batch_size=64,normalize=True)# apply the learned linear map to the dataX_nca=nca(X)Dimensionality ReductionWe generate a 3-D dataset where the first 2 dimensions are concentric rings and the third dimension is Gaussian noise. We plot the result of PCA, LDA and NCA with 2 components.Notice how PCA has failed to project out the noise, a result of a high noise variance in the third dimension. LDA also struggles to recover the concentric pattern since the classes themselves are not linearly separable.kNN on MNISTWe compute the classification error, computation time and storage cost of two algorithms:kNN (k = 5) on the raw 784 dimensional MNIST datasetkNN (k = 5) on a learned 32 dimensional NCA projection of the MNIST datasetMethodNCA + kNNRaw kNNTime2.37s155.25sStorage6.40 Mb156.8 MbError3.3%2.8%
Package: torch-nested
torch-nestedEasily manipulatetorch.Tensorsinside highly nested data-structures.You may want to consider usingtorch.nested,
but if you are working with nesteddicts,lists,tuples, etc. oftorch.Tensors,
here is the package for you.A proper documentation is coming. Until then, a basic example is shown below, and you can look at the docstrings
or tests of this package for more information.Basic usageGiven a nested structure that containstorch.Tensor, this package makes it easy to access theseTensorsand
work with them:importtorchfromtorch_nestedimportNestedTensorsINPUT_DATA=[(torch.ones(3),torch.zeros(2)),torch.ones((2,2,2)),{"foo":torch.ones(2),"bar":[],"har":"rar"},1]tensors=NestedTensors(INPUT_DATA)# Original data preserved in .data-memberasserttensors.data==INPUT_DATA# Simple accessing and settingfori,tensorinenumerate(tensors):tensors[i]=tensor+i# Has basic dundersassertlen(tensors)==4asserttorch.all(next(tensors)==torch.ones(3))Callingprint(tensors.shape())would yield:torch_nested.Size(
  [
    (
      torch.Size([3]),
      torch.Size([2])
    ),
    torch.Size([2, 2, 2]),
    {
      foo: torch.Size([2]),
      bar: None,
      har: None
    },
    None
  ]
)Supported data-structuresThe following data-structures are supported so far:torch.TensordictlisttupleNoneAny class with a.tensors-attributeAny class with a.data-attribute, even if it isn't atorch.TensorFor exampleclassObjWithTensors:tensors=[torch.ones(2),torch.zeros(2)]classObjWithData:data=[torch.ones(2),torch.zeros(2)]tensors=NestedTensors([ObjWithTensors(),ObjWithData()])Runningprint(tensors.size())would result in the following output:NestedSize(
  [
    ObjWithTensors(
      tensors: [
        torch.Size([2]),
        torch.Size([2])
      ]
    ),
    ObjWithData(
      data: [
        torch.Size([2]),
        torch.Size([2])
      ]
    )
  ]
)More data-structures will be supported in the future. Any data that is of an unsupported type
will not have itsTensorsreadable or writable, andNestedShapewill showNonethere.
Package: torch-nets
Compose PyTorch neural networks with ease.InstallationFrom PYPI (current version:v0.0.5)pipinstalltorch-netsAlternatively, install the development version from GitHub:gitclonehttps://github.com/mvinyard/torch-nets.git;cdtorch-nets;pipinstall-e.Example API use-casesfromtorch_netsimportTorchNetCreate a feed-forward neural networkThe only required arguments arein_featuresandout_features. The network can be made as simple or complex as you want through optional parameters.net=TorchNet(in_features=50,out_features=50,hidden=[400,400],activation="LeakyReLU",dropout=0.2,bias=True,output_bias=True,)See outputTorchNet(
  (hidden_1): Sequential(
    (linear): Linear(in_features=50, out_features=400, bias=True)
    (dropout): Dropout(p=0.2, inplace=False)
    (activation): LeakyReLU(negative_slope=0.01)
  )
  (hidden_2): Sequential(
    (linear): Linear(in_features=400, out_features=400, bias=True)
    (dropout): Dropout(p=0.2, inplace=False)
    (activation): LeakyReLU(negative_slope=0.01)
  )
  (output): Sequential(
    (linear): Linear(in_features=400, out_features=50, bias=True)
  )
)DocumentationFor more information, including examples of additional use-cases please visit thedocumentation(coming soon)! Additional use-cases include:Encoder,Decoder,AugmentedTorchNet.Potential future plansFlexible composition oftorch.optimfuncs.Potentialpytorch_lightninguse-cases.Problem?Open anissueor get in touch viaemail.
Package: torchninja
torchninjatorchninja is a Python package that provides tools for training PyTorch models. It offers a flexible and easy-to-use training framework with built-in functionality for logging, metrics tracking, and model checkpointing.FeaturesSimplifies the process of training PyTorch models.Flexible and customizable trainer class.Automatic logging of training progress and metrics.Support for model checkpointing to save and load model states.Easy integration with TensorBoard for visualizing training metrics.Provides utility functions for common tasks in PyTorch model training.InstallationYou can install torchninja using pip:pipinstalltorchninjatorchninja has the following dependencies:torchtorchvisiontensorboardtqdmnumpymatplotlibMake sure these dependencies are installed in your environment before using torchninja.Getting StartedTo get started with torchninja, you can refer to theexamplesdirectory in the project repository. It contains example scripts that demonstrate how to use the torchninja trainer class to train a PyTorch model. You can modify these examples according to your specific use case.DocumentationThe documentation for torchninja is available on the project's GitHub repository:torchninja GitHub repositoryThe documentation provides detailed information on the usage of the torchninja package, including the trainer class, available functionality, and usage examples.ContributingContributions to torchninja are welcome! If you find any issues, have suggestions for improvements, or would like to add new features, please open an issue or submit a pull request on the project's GitHub repository.Licensetorchninja is released under the MIT License. See theLICENSEfile for details.ContactFor any questions or inquiries, you can reach out to the project author:Author: Silvan FerreiraEmail:silvanfj@gmail.comFeel free to contact the author for any assistance or collaboration opportunities related to torchninja.
Package: torch-nl
torch_nlProvide a pytorch implementation of a naive (compute_neighborlist_n2) and a linked cell (compute_neighborlist) neighbor list that are compatible with TorchScript.Their correctness is tested against ASE's implementation.Note that contrary to ASE, the atoms positions are assumed to be wrapped inside the unit cell.How toinstal with pippipinstalltorch-nluse the neighborlistfromtorch_nlimportcompute_neighborlist,ase2datafromase.buildimportbulk,moleculeframes=[bulk("Si","diamond",a=6,cubic=True),molecule("CH3CH2NH2")]pos,cell,pbc,batch,n_atoms=ase2data(frames)mapping,batch_mapping,shifts_idx=compute_neighborlist(cutoff,pos,cell,pbc,batch,self_interaction)BenchmarksPeriodic structure