Saravanan666/pypi-org huggingface dataset:
Package: batch-async-http
batch-async-httpThis tool was designed to make batch async requests via http very simple! All you need to do is attach a decorator to your http request function and the rest is handled for you.Behind the scenes your input is turned into a generator with batches of your specified size, and mapped asynchronously to your http request function!See the source for this project here:https://https://github.com/MiesnerJacob/batch_async_http.How to install:pip install batch-async-httpUsageA typical function to make http requests to a REST API may look something like this:importrequestsdefcall_api(example_input:list):# URL to callurl='http://xx.xxx.xxx.xx/example_endpoint/'# Input to APIparams={"raw":example_input,}# API callsr=requests.post(url,json=params)response=r.json()returnresponseA typical async function to make http requests to a REST API may look something like this:importhttpxasyncdefcall_api(example_input:list):# URL to callurl='http://xx.xxx.xxx.xx/example_endpoint/'# Input to APIparams={"raw":example_input,}# Concurrent API callsasyncwithhttpx.AsyncClient(timeout=None)asclient:r=awaitclient.post(url,json=params)response=r.json()returnresponseThe power of batching your async requests is now just as easy as applying a simple decorator to your async function:importhttpxfrombatch_async_httpimportbatch_async@batch_async(size=8)asyncdefcall_api(example_input:list):# URL to callurl='http://xx.xxx.xxx.xx/example_endpoint/'# Input to APIparams={"raw":example_input,}# Concurrent API callsasyncwithhttpx.AsyncClient(timeout=None)asclient:r=awaitclient.post(url,json=params)response=r.json()returnresponseEnjoy your increased efficiency with minimal effort!
Package: batch-automation
Batch AutomationBatch Automation is a Python library with a variety of functions and APIs for dealing with 3d and non-3d related stuff.A few examples:AWS Thinkbox Deadline APIBlackmagic APIGoogle Services APIMongoDB APICustom Toolsmore functions will be added overtimeInstallationUse the package managerpipto install Batch Automation.pipinstallbatch_automationUsageAWS Thinkbox Deadline APIfrombatch_automation.deadline.custom.customimport*# Returns all jobs in selected repository.print(Repository('WebServiceName',Port).GetJobs())# Returns all jobs in selected repository.print(Repository('WebServiceName',Port).GetJobByName('Job-Name'))# Returns a job details.# you can search by "job_name" or "job_id", job_id method is a lot quickerprint(Repository('WebServiceName',Port).GetJobDetails('Job-Name'))# Create the info_file and plugin_file and submit them to deadlineinfo_file=Repository().JobInfo(Name='Job-Name',UserName='UserName',Frames='1',Plugin='VraySpawner')plugin_file=Repository().PluginInfo(Version='Max2023')print(Repository('WebServiceName',Port).SubmitJob(info_file,plugin_file))All standard api calls are included as wellfrombatch_automation.deadline.api.DeadlineConnectimportDeadlineConasConnectrepo=Connect('WebServiceName',Port)#The list of Group names.print(repo.Groups.GetGroupNames())# The list of Jobsprint(repo.Jobs.GetJobs())Blackmagic API Full list of funcionsLinkfrombatch_automation.davinci.MediaPoolimportMediaPoolfrombatch_automation.davinci.ProjectManagerimportProjectManager# Returns currently selected Folderprint(MediaPool.GetCurrentFolder())# Adds new timeline with given nameprint(MediaPool.CreateEmptyTimeline('New-Timeline'))# Imports specified file/folder paths into current Media Pool folder.# Input is an array of file/folder paths. Returns a list of the MediaPoolItems created.print(MediaPool.ImportMedia(['/mdeia/clip.mov']))# Creates and returns a project if projectName (string) is unique, and None if it is not.print(ProjectManager.CreateProject('New-Project'))# Returns a list of dictionary items (with keys 'DbType', 'DbName' and optional 'IpAddress')# corresponding to all the databases added to Resolveprint(ProjectManager.GetDatabaseList())# Loads and returns the projectprint(ProjectManager.LoadProject('Project-Name'))...Google APIfrombatch_automation.google.apiimportcreate_service# Creates an Google Serviceprint(create_service('https://www.googleapis.com/auth/spreadsheets','sheets','v4','/cred/OAuth.json'))ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseApache Software License 2.0
Package: batchbald-redux
BatchBALD ReduxClean reimplementation of "BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning"For an introduction & more information, seehttp://batchbald.ml/. The paper can be found athttp://arxiv.org/abs/1906.08158.The original implementation used in the paper is available athttps://github.com/BlackHC/BatchBALD.We are grateful for fastai'snbdevwhich is powering this package.For more information, explore the sections and notebooks in the left-hand menu.
The code is available onhttps://github.com/BlackHC/batchbald_redux,
and the website onhttps://blackhc.github.io/batchbald_redux.Installpip install batchbald_reduxMotivationBatchBALD is an algorithm and acquisition function for Active Learning in a Bayesian setting using BNNs and MC dropout.The aquisition function is the mutual information between the joint of a candidate batch and the model parameters $\omega$:{% raw %}
$$a_{\text{BatchBALD}}((y_b)_B) = I[(y_b)_B;\omega]$$
{% endraw %}The best candidate batch is one that maximizes this acquisition function.In the paper, we show that this function satisfies sub-modularity, which provides us an optimality guarantee for a greedy algorithm. The candidate batch is selected using greedy expansion.Joint entropies are hard to estimate and, for everything to work, one also has to use consistent MC dropout, which keeps a set of dropout masks fixed while scoring the pool set.To aid reproducibility and baseline reproduction, we provide this simpler and clearer reimplementation.Please cite us@misc{kirsch2019batchbald,
    title={BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning},
    author={Andreas Kirsch and Joost van Amersfoort and Yarin Gal},
    year={2019},
    eprint={1906.08158},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}How to useWe provide a simple example experiment that uses this packagehere.To get a candidate batch using BatchBALD, we provide a simple API inbatchbald_redux.batchbald:get_batchbald_batch[source]get_batchbald_batch(log_probs_N_K_C:Tensor,batch_size:int,num_samples:int,dtype=None,device=None)We also provide a simple implementation of consistent MC dropout inbatchbald_redux.consistent_mc_dropout.
Package: batchbook-python
Batchbook-pythonBatchbook API wrapper written in python.Installingpip install batchbook-pythonUsageSimple access with API KEYfrom batchbool.client import Client

client = Client('API_KEY')Get Contactsclient.get_contacts()Get an specific contactclient.get_contact(contact_id)Requirements-Requests
-UrllibTODOCompaniesCustom FieldsUsersRolesCommunications
Package: batchcli
This small library provide an easy way to run some tasks in batch and track progress on the CLI.An example of output you can get is the following:[ 1/7 ] Put oil in the pan
[ ... ] ...
[ 2/7 ] Turn fire on
[ ... ] ...
[ 3/7 ] Break the egg
[ ... ] ...
[ 4/7 ] Put the egg in the pan
[ ... ] ...
[ 5/7 ] Wait the egg is cooked
[ ... ] ...
[ 6/7 ] Put the egg in the dish
[ ... ] ...
[ 7/7 ] Add salt to the egg and eat it!
[ ... ] ...The module provide an api to define tasks and add them to a task engine:cli = SimpleCli()
engine = TaskEngine(cli)

engine.addTask(Print("Put oil in the pan"))
engine.addTask(Print("Turn fire on"))
engine.addTask(Print("Break the egg"))
engine.addTask(Print("Put the egg in the pan"))
engine.addTask(Print("Wait the egg is cooked"))
engine.addTask(Print("Put the egg in the dish"))
engine.addTask(Print("Add salt to the egg and eat it!"))

engine.run()In the example above Print is a class extending Task (defined in the module):class Print(Task):
   "Simple Task: do nothing more than printing ..."

   def run(self, cli):
       cli.newMessageIn case a task fails the task engine stops immediately and return from the method run.
Package: batchcreate
Batchcreator takes an array of records as input and splits it into suitably sized batches of records which can be further processed or passed to any other system/s.Quick start:1.Install:$ pip install batchcreate2.Import BatchCreator iterator class and instantiate it. You can use below parameters to define output batch limits. These parameters are optional. If neither of these parameters is specified then the default values will be used. The default limits as :max_record_size=1MBThe maximum size limit for a record in the output batch. Any record with larger size than this will be skipped from batching.max_batch_size=5MBThe maximum size limit for a batch.max_batch_num_records=500The maximum number of records limit for a batch. BatchCreator will put maximum these many records per batch provided batch size satisfies the limit.from batchcreate import BatchCreator

batches = BatchCreator(records,
                       max_record_size=60,
                       max_batch_size=200,
                       max_batch_num_records=4)3.The iterable BatchCreator object can give suitable batches as needed on iteration. The BatchCreator object can be used in a regular 'for' loop.for batch in batches:
    print(batch) #batch processing here
    print('\n')ORbatchItr = iter(batches)
print(next(batchItr)) #batch processing here4.BatchCreator can return the list of all the batches as well.batches = BatchCreator(records).batches()Docs:Library available at :batchcreateDocumentation at :Batchcreate Documentation
Package: batch-debugging-cli
Batch Debugging CLIThe Batch Debugging CLI is designed to streamline the debugging process for AWS Batch, GCP, Azure, and Kubernetes compute environments. Leveraging the capabilities of [batch-debugging](https://github.com/Shahbaz-mahmood123/batch-debugging).Explore the documentation »Table of ContentsAbout The ProjectInstallationGetting StartedContactAbout The ProjectThe Batch Debugging CLI is a command-line tool designed to assist in debugging batch compute environments across AWS, GCP, Azure, and Kubernetes. It currently relies onbatch-debuggingfor its underlying logic, so refer to its documentation for detailed information on the debugging process.Please note that the CLI assumes AWS Batch compute environments were built using the Seqera platform. However, a more generic debugging tool will be implemented in the future.InstallationTo use this library, just install the package via pip.pipinstallbatch-debugging-cliGetting StartedBefore using the CLI, ensure you have an account in your compute provider, a valid compute enviornment and credentials to access the account(AWS, GCP, Azure)Currently, the CLI supports a few commands, and it expects the environment name to match the corresponding AWS environment. When supplying a compute environment ID, provide the full name of the environment (e.g., TowerForge-1rVcJ5K5wnvky3zohO4EaN-head).AWSFor AWS please declare the region where your batch enviornmets are located. For example:exportAWS_REGION=us-east-1Additionally the below IAM permissions are required.GCPTo use the GCP commands please use the set the below enviornment variables:exportGCP_PROJECT_ID=test-environmentexportGCP_REGION=us-central1For Seqera platform, please declare the below two enviornment variables prior to attempting to run any of the seqera cli commands:exportPLATFORM_TOKEN=exportPLATFORM_URL=ContactShahbaz Mahmood -shahbazmahmooood@gmail.com
Package: batchdist
batchdistThis is a small PyTorch-based package which allows for efficient batched operations, e.g. for computing distances without having to slowly loop over all instance pairs of a batch of data.After having encountered mulitple instances of torch modules/methods promising to handling batches while only returning a vector of pairwise results (see example below) instead of the full matrix, this package serves as a tool to wrap such methods in order to return full matrices (e.g. distance matrices) using fast, batched operations (without loops).ExampleFirst, let's define a custom distance function that only computes pair-wise distances for batches, so two batches of each 10 samples are
converted to a distance vector of shape (10,).>>>defdummy_distance(x,y):"""This is a dummy distance d which allows for a batch dimension(say with n instances in a batch), but does not return the fulln x n distance matrix but only a n-dimensional vector of thepair-wise distances d(x_i,y_i) for all i in (1,...,n)."""x_=x.sum(axis=[1,2])y_=y.sum(axis=[1,2])returnx_+y_# batchdist wraps a torch module around this callable to compute# the full n x n matrix with batched operations (no loops).>>>importbatchdistasbd>>>batched=bd.BatchDistance(dummy_distance)# generate data (two batches of 256 samples of dimension [4,3])>>>x1=torch.rand(256,4,3)>>>x2=torch.rand(256,4,3)>>>out1=batched(x1,x2)# distance matrix of shape [256,256]For more details, consult the included examples.InstallationWith poetry:$ poetry add batchdistWith pip:$ pip install batchdist
Package: batche
batchebatcheprovides a Python decorator that caches the results of a batch function. It helps in reducing computation by caching the outputs for previously processed input batches. The cache is maintained using a dictionary or an LRU (Least Recently Used) Cache, based on the maxsize parameter.InstallationpipinstallbatcheUsageTo use this decorator, simply import it and apply it to a function that takes a batch of items (list) as input and returns a list of predictions. The decorator will cache the results of the function for previously processed items.frombatcheimportcache_batch_variable# batch_variable_name (str): The name of the argument in your batch function that holds the input batch list. This is a required parameter.# maxsize (int, optional): The maximum size of the cache (uses an LRU Cache).#                          If not provided, the cache used will be a dict.@cache_batch_variable(batch_variable_name="batch_items",maxsize=100)defbatch_function(batch_items:List[HashableType])->List[Any]:# Your implementation herereturnexpensive_operation(batch_items)ExampleHere is a complete example using the cache_batch_variable decorator:fromcache_batch_decoratorimportcache_batch_variable@cache_batch_variable(batch_variable_name="batch_items",maxsize=100)defbatch_function(batch_items:List[str])->List[str]:# Simulating some heavy computationresult=[item.upper()foriteminbatch_items]returnresult# Test the batch_functioninput_batch=["hello","world"]output_batch=batch_function(input_batch)print(output_batch)>['HELLO','WORLD']# Calling the function again with overlapping examples# The results for the overlapping examples will be fetched from the cache# The results for the new examples will be computedinput_batch=["hello","again",]output_batch=batch_function(input_batch)print(output_batch)>['HELLO','AGAIN']When calling the function with the same input batch again, the results will be fetched from the cache, improving the performance.
Cache TypesBy default, the cache size is unlimited (uses a dictionary). If you want to limit the cache size, you can use themaxsizeparameter. This will create an LRU Cache with the specified size:Important NotesThe decorator checks for correct annotations of the batch function (input and return types should be a list). If annotations are not provided, it skips the validation.The input batch variable must contain hashable objects.The batch function must return a list of predictions with the same length as the input batch.The gains in performance will depend on the size of the input batch and the computation time of the batch function. If the batch function is very fast, the gains will be minimal. This is also only useful if you are calling the batch function with possible duplicate examples multiple times.Possible ImprovementsAdd support for multiple batch variables (e.g. batch_items, batch_labels, batch_ids, etc.)Add support for custom cache implementations and hash functionsAdd run-time annotations validationContributingContributions are welcome! Please open an issue if you have any suggestions or improvements.LicenseThis project is licensed under the MIT License.
Package: batchedffmpeg
BatchedFFmpegProcess multiple videos with one line of ffmpeg command.RequirementsffmpegInstallpip install batchedffmpegUsagebatchedffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…Usage for command is the same with original ffmpeg besidesinfile.infilecan be a video file orfolder(=directory) where the video files are saved. Ifinfileis a folder, program will search all video files in a folder including subfolders and then those files will be processed under the same command.The output file is saved differently depending on the extension ofoutfile.ifoutfile== video:input/
    hi.mp4
    bye.mp4After running command(outfile=./output/out.avi)...output/
    hi_out.avi
    bye_out.avielifoutfile== img:input/
    hi.mp4
    bye.mp4After running command(outfile=./output/out%4d.jpg)...output/
    hi/
      hi_out0001.jpg
      hi_out0002.jpg
      ...
    bye/
      bye_out0001.jpg
      bye_out0002.jpg
      ...
Package: batchelor
A simple, yet effective batching system using threadpoolexecutor.Free software: GNU Lesser General Public License v3 or later (LGPLv3+)Installationpip install batchelorYou can also install the in-development version with:pip install https://github.com/ritzKraka/python-batchelor/archive/master.zipDocumentationTo use the project:importbatchelorbatch=batchelor.Batch(enumerate(['my','dataset']))# batch.help() # for basic helpbatch.start(lambdaindex,item:print(index,item))# replace lambda with your functionDevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.1 (2020-06-12)First release on PyPI.0.3 (I forget)Stop doing changelog because I’m too lazy. :)0.5.5 (last one)Added command-line argument support.
Package: batch-face
Batch Face for Modern Research🚧Documentation under construction, check tests folder for more details. 🚧This repo provides the out-of-box face detection and face alignment with batch input support and enables real-time application on CPU.FeaturesBatch input support for faster data processing.Smart API.Ultrafast with inference runtime acceleration.Automatically download pre-trained weights.Minimal dependencies.RequirementsLinux, Windows or macOSPython 3.5+ (it may work with other versions too)opencv-pythonPyTorch (>=1.0)ONNX (optional)While not required, for optimal performance it is highly recommended to run the code using a CUDA enabled GPU.InstallThe easiest way to install it is using pip:pipinstallgit+https://github.com/elliottzheng/batch-face.git@masterNo extra setup needs, most of the pretrained weights will be downloaded automatically.UsageYou can clone the repo and run tests like thispython -m tests.cameraFace DetectionDetect face and five landmarks on single imageimportcv2frombatch_faceimportRetinaFacedetector=RetinaFace(gpu_id=0)img=cv2.imread("examples/obama.jpg")faces=detector(img,cv=True)# set cv to False for rgb input, the default value of cv is Falsebox,landmarks,score=faces[0]Running on CPU/GPUIn order to specify the device (GPU or CPU) on which the code will run one can explicitly pass the device id.frombatch_faceimportRetinaFace# 0 means using GPU with id 0 for inference# default -1: means using cpu for inferencedetector=RetinaFace(gpu_id=0)GPU(GTX 1080TI,batch size=1)GPU(GTX 1080TI，batch size=750)CPU(Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz)FPS44.0240581072089396.6405800558253515.452635835550483SPF0.0227148528099060070.0103476200103759760.0647138786315918Batch input for faster detectionDetector with CUDA process batch input faster than the same amount of single input.importcv2frombatch_faceimportRetinaFacedetector=RetinaFace()img=cv2.imread('examples/obama.jpg')[...,::-1]all_faces=detector([img,img])# return faces list of all imagesbox,landmarks,score=all_faces[0][0]Note: All the input images must of the same size, for input images with different size, please usedetector.pseudo_batch_detect.Face Alignmentface alignment on single imagefrombatch_faceimportdrawLandmark_multiple,LandmarkPredictor,RetinaFacepredictor=LandmarkPredictor(0)detector=RetinaFace(0)imgname="examples/obama.jpg"img=cv2.imread(imgname)img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)faces=detector(img)iflen(faces)==0:print("NO face is detected!")exit(-1)# the first input for the predictor is a list of face boxes. [[x1,y1,x2,y2]]results=predictor(faces,img,from_fd=True)# from_fd=True to convert results from our detection results to simple boxesforface,landmarksinzip(faces,results):img=drawLandmark_multiple(img,face[0],landmarks)ReferencesFace Detection Network and pretrained model are frombiubug6/Pytorch_RetinafaceFace Alignment Network and pretrained model are fromcunjian/pytorch_face_landmarkFace Reconstruction Network and pretrained model are fromcleardusk/3DDFA
Package: batchfile.py
Batchfile.pyA Python library to execute simple batch files (.bat) that would normally only work on Windows. After installing, you can get a REPL (live commandline) to test by runningpython3 -m batchfileWhen I was in high school I used to write text adventure games using Windows batch files. In October 2020 I wrote a Python script to interpret the batch files. This is a fun experiment to see if I can get unaltered original batch file games to play on Ubuntu using Python without introducing too much complexity.See mybat2webrepo for an example of how you can use this library to turn a batch file into a website. Something you've always wanted to do, surely :)How to playInstall library by runningpip install .in the same folder as thesetup.pyfile.Go in the/gamesdirectory for python scripts that will launch games.So far the only supported game is one I wrote when I was 16, which you can play by runningfuntimes.pyusing Python 3.6+ on Linux, Windows, or MacOS.On Windows you can also play the original game without Python usingFUNTIMES.batinside the funtimes directoryThe original game actually works usingwineconsolein Ubuntu as well, except for rare math problemsFuntimes can also be playedin a web browserRunning other batch filesI definitely don't intend to support every batch file, but it would be nice if similar batch-file-games worked without introducing too much complexity. Another game I wrote in 2010 called "Recruitment" is included as an example, but it doesn't yet work. Ultimately it would be really cool if this library supportedTime Streamer.The main obstacle to most games working is the lack of support for parentheses and quotation marks. Some hacky solutions are included to deal with the simple cases in Funtimes, but eventually I have to write a tokenizer/lexer to correctly deal with these complex structures. This should greatly increase compatibility once I do that!Another obstacle is that a lot of batch files use weird .EXE or .COM files that do various tasks, but when I discover these cases I'll try to include them as standard functions. My primary goal is supporting batch file games, so I'm not worried about if something is a "pure" batch file.