semvec/pypi-packages huggingface dataset:
m-promptune 0.2.8
DSPy acceleration
License: MIT

# M PROMPTUNE
## Accelerates DSPy
Uses batch Expected Improvement to suggest multiple prompts to run in parallel. The mipro_optimizer_v2.py can parallelize but only at the the data evaluation level. The qEI sampler allows parallelization at the prompt level. Running prompts is definitely an IO bound process and you should definitely be running more threads than cores.
## Semantic Based
Tree Parzen Estimator [does't really handle](https://proceedings.mlr.press/v108/ma20a/ma20a.pdf) covariance between categorical variables. Instead of using Tree Parzen Estimator with a categorical distribution, qEI uses a Gaussian Process fit on **embeddings** of the possible combinations. This applies Bayesian Optimization at the **semantic** level in parallel.
## Forked Repository
Until my changes are merged with DSPy, I created a [forked repository](https://github.com/sign-of-fourier/dspy) that allows a sampler to be passed when initializing mipro_sampler_v2.

It is backwards compatible with DSPy and the same in every other way.
```
git git+https://github.com/sign-of-fourier/dspy.git      
```

Install this sampler that uses batch Expected Improvment.
```
pip install m-promptune
```

qEI.Sampler(instruction_candidates, demo_candidates, max_space_size, n_batches, batch_size, min_cold_start)
- **instruction candidates**: generated internally by the MIMPROv2 sampler.
- **demonstration_candidates**: also generated internally.
- **max_space_size**: when sampling, the maximum number of points to consider.
- **n_batches**: when batching, the number of batches. *In this context, a batch is a group of suggestions.*
- **batch_size**: number in each batch
- **min_cold_start**: run with random selections until you get to this point


This example from DSPy optimizes instruction, few shot combinations.

You will need tokens from [Open AI](https://platform.openai.com/api-keys) and [RapidAPI](https://rapidapi.com/info-FLGers_gH/api/batch-bayesian-optimization).
```
import os
import dspy
from mpromptune import qEI
from dspy.datasets.gsm8k import GSM8K, gsm8k_metric
from dspy.teleprompt import MIPROv2

os.environ['OPEN_AI_KEY']='Your token here'
os.environ['X_RAPIDAPI_KEY']='Your token here'
```
Using example data (Grade school math 8K). n_jobs controls parallelization at the prompt level.
```
gsm8k = GSM8K()
optimized_program = teleprompter.compile(
    dspy.ChainOfThought("question -> answer"),
    trainset=gsm8k.train,
    n_jobs=2,
    sampler=qEI.qEISampler()
)
```
Specify the number of threads for parallelizing at the data evaluation level.
```
lm = dspy.LM('openai/gpt-4o-mini', api_key=os.environ['OPEN_AI_KEY'])
dspy.configure(lm=lm)
teleprompter = MIPROv2(
    metric=gsm8k_metric,
    auto="light",
    num_threads=2
)
```

Contact me for questions info@quantecarlo.com
flake8-unused-arguments 0.0.14
flake8 extension to warn on unused function arguments
License: MIT

# flake8-unused-arguments

A flake8 plugin that checks for unused function arguments.

This package adds the following warnings:

 - `U100` - An unused argument.
 - `U101` - An unused argument starting with an underscore

Configuration options also exist:
 - `unused-arguments-ignore-abstract-functions` - don't show warnings for abstract functions.
 - `unused-arguments-ignore-overload-functions` - don't show warnings for overload functions.
 - `unused-arguments-ignore-override-functions` - don't show warnings for overridden functions.
 - `unused-arguments-ignore-stub-functions` - don't show warnings for empty functions.
 - `unused-arguments-ignore-variadic-names` - don't show warnings for unused *args and **kwargs.
 - `unused-arguments-ignore-lambdas` - don't show warnings for all lambdas.
 - `unused-arguments-ignore-nested-functions` - don't show warnings for nested
   functions. Only show warnings for functions in the top level of a module, or methods
   of a class in the top level of a module.
 - `unused-arguments-ignore-dunder` - don't show warnings for double-underscore methods.
   These methods implement or override native builtin methods which have a specific
   signature. Therefore arguments must always be present. This is the case of methods
   like `__new__`, `__init__`, `__getitem__`, `__setitem__`, `__reduce_ex__`,
   `__enter__`, `__exit__`, etc.

## Changelog

0.0.14
 - Fixed compatibility with Python 3.14. Thanks to John T. Wodder II for contributing the fix!

0.0.13
 - Added a new option for ignoring functions decorated with the override decorator. Thanks to Thomas M Kehrenberg for contributing this!

0.0.12
 - Fixed an issue causing flake8 --help to break. Thanks to Calum Young for contributing this fix!
 - Starting from this release, automated CI runs on each Github PR. Thanks again to Calum Young for contributing this work!

0.0.11
 - Added a new option for ignoring functions decorated with overload.
 - Added a new option for ignoring dunder methods (double-underscore) methods.

0.0.10
 - Added new options for ignoring lambdas and nested functions. Thanks to João Eiras for contributing these!

0.0.9
 - Check nested functions.
 - Don't crash if an attribute is used in a raise statement.

0.0.8
 - Whoops, report the right version when using flake8 --help.

0.0.7
 - The first unused argument in a @classmethod decorated function wasn't properly detected. Thanks to Sebastian Dietrich for contributing the fix!

0.0.6
 - Stub functions that have docstrings are now correctly detected as stub functions
 - Functions with only a docstring are considered stub functions

0.0.5
 - The positions reported are now for the arguments themselves, rather than the function

0.0.4
 - Wrong project name in the readme, whoopsies

0.0.3
 - treat functions that start with "raise NotImplementedError()" as stub functions

0.0.2
 - fixed error in packaging

0.0.1
 - initial release