mteb/LocBenchRR huggingface dataset:
Boolean as tool input
### Feature request

It would be great if `boolean` was authorized as input to a `Tool`

### Motivation

I am willing to use my own tools with transformers CodeAgent ; using the method `tool`
I have a proper function `func` with typing and doc-strings as required. One of the input of the function is a `bool`.
When I try to run `tool(func)` I get: `Exception: Input 'perte_de_salaire': type 'boolean' is not an authorized value, should be one of ['string', 'integer', 'number', 'image', 'audio', 'any']`.

The Exception is rather clear, but why wouldn't a type as basic as `boolean` not be allowed? Especially since any is authorized. This is clearly a limitation to using the library.

### Your contribution

I seems like a few lines of code to change in tools.py (https://github.com/huggingface/transformers/blob/main/src/transformers/agents/tools.py)
[MRG] ENH: Added block_size parameter for lesser memory consumption
#### Reference Issue
Fixes #7287


#### What does this implement/fix? Explain your changes.
This intends to add a function `pairwise_distances_blockwise` with an additional block_size parameter to avoid storing all the O(n^2) pairs' distances. This would then be used by `neighbors`, `silhouette_score` and `pairwise_distances_argmin_min`.

#### Any other comments?

- [x] Stacking within `pairwise_distances_reduce`
- [x] Revert changes to `sklearn/neighbors`
- [x] Docstring for `pairwise_distances_reduce`
- [x] Tests for `pairwise_distances_reduce`
Avoid potential admin model enumeration
Description
	 
When attacking a default Django server (one created with startproject is sufficient), you can enumerate the names of the applications and models by fuzzing the admin URL path. A redirect indicates that the model exists in that application, while a 404 indicates it does not. This can be done without any authentication. For example:
​http://127.0.0.1:8000/admin/auth/user/ -> 302 to login
​http://127.0.0.1:8000/admin/auth/group/ -> 302 to login
​http://127.0.0.1:8000/admin/auth/foo/ -> 404
I originally raised this with the security team and after some discussion they requested a public ticket for this.
Avoid potential admin model enumeration
Description
	 
When attacking a default Django server (one created with startproject is sufficient), you can enumerate the names of the applications and models by fuzzing the admin URL path. A redirect indicates that the model exists in that application, while a 404 indicates it does not. This can be done without any authentication. For example:
​http://127.0.0.1:8000/admin/auth/user/ -> 302 to login
​http://127.0.0.1:8000/admin/auth/group/ -> 302 to login
​http://127.0.0.1:8000/admin/auth/foo/ -> 404
I originally raised this with the security team and after some discussion they requested a public ticket for this.
Add warning to runserver that it should not be used for production
Description
	 
As per this discussion on the ​forum, I think adding a warning to the start of runserver would be valuable to those new to Django and a healthy reminder to those coming back to Django. 
The wording of the warning is:
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
For more information on production servers see the documentation: https://docs.djangoproject.com/en/5.0/howto/deployment/
Additionally a flag should be added to optionally hide the warning. --hide-unsuitable-for-production was a suggestion.
Finally the following 2 pages of the documentation should have add some wording to highlight that a deployed project should not use runserver.
​https://docs.djangoproject.com/en/5.0/howto/deployment/ (Add a warning or paragraph that mentions switching)
​https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ (Add a section to switch away from runserver)
Add warning to runserver that it should not be used for production
Description
	 
As per this discussion on the ​forum, I think adding a warning to the start of runserver would be valuable to those new to Django and a healthy reminder to those coming back to Django. 
The wording of the warning is:
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
For more information on production servers see the documentation: https://docs.djangoproject.com/en/5.0/howto/deployment/
Additionally a flag should be added to optionally hide the warning. --hide-unsuitable-for-production was a suggestion.
Finally the following 2 pages of the documentation should have add some wording to highlight that a deployed project should not use runserver.
​https://docs.djangoproject.com/en/5.0/howto/deployment/ (Add a warning or paragraph that mentions switching)
​https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ (Add a section to switch away from runserver)
[shmap] shard_map doesn't support multiple axes
### Description

```
import functools

import jax
from jax import numpy as jnp
from jax import sharding
from jax.experimental import mesh_utils
from jax.experimental import shard_map

mesh = sharding.Mesh(
    mesh_utils.create_device_mesh((1, 1), jax.devices()[:1]), ('x', 'y')
)


@functools.partial(
    shard_map.shard_map,
    mesh=mesh,
    in_specs=(sharding.PartitionSpec(('x', 'y')),),
    out_specs=sharding.PartitionSpec(('x', 'y')),
)
def shmap(x):
  return jax.lax.all_to_all(
      x, ('x', 'y'), split_axis=1, concat_axis=1, tiled=True
  )


shmap(jnp.arange(64).reshape((8, 8)))
```

throws

```
NotImplementedError                       Traceback (most recent call last)
[<ipython-input-15-054b2c13eea0>](https://colab.corp.google.com/drive/1BrxzONkVzmempZ6vhNoQfMm29kmKZUqE?resourcekey=0-8USnR6nL2HfsuYRxxqzFbw#) in <module>()
     24 
     25 
---> 26 shmap(jnp.arange(64).reshape((8, 8)))

[<ipython-input-15-054b2c13eea0>](https://colab.corp.google.com/drive/1BrxzONkVzmempZ6vhNoQfMm29kmKZUqE?resourcekey=0-8USnR6nL2HfsuYRxxqzFbw#) in shmap(x)
     19 )
     20 def shmap(x):
---> 21   return jax.lax.all_to_all(
     22       x, ('x', 'y'), split_axis=1, concat_axis=1, tiled=True
     23   )

NotImplementedError:
```

from

https://github.com/google/jax/blob/5c5e8f032a83ea88333ef53d076e3b21dad60059/jax/experimental/shard_map.py#L926

Proposed a fix in https://github.com/google/jax/pull/19601.

### What jax/jaxlib version are you using?

0.4.24

### Which accelerator(s) are you using?

CPU/TPU

### Additional system info?

1.26.3 3.11.7 (stable, redacted, redacted) [Clang google3-trunk (0784b1eefa36d4acbb0dacd2d18796e26313b6c5)] uname_result(system='Linux', node='258826a665cf1304-84aaaed3d9.borgtask.google.com', release='5.10.0-smp-1100.465.0.0', version='#1 [v5.10.0-1100.465.0.0] SMP @1704273398', machine='x86_64')

### NVIDIA GPU info

_No response_
Warning raised with default `from_zarr` settings

**Describe the issue**:
Reading a zarr array with `dask.array.from_zarr` raises a `UserWarning`, but I'm not doing anything wrong. 

**Minimal Complete Verifiable Example**:

```python
import dask.array
import zarr

zarr_arr = zarr.open(shape=(6, 6, 6), store="./zeros.zarr", chunks=(3, 3, 2), mode='w')
zarr_arr[:] = 0

dask_arr = dask.array.from_zarr("./zeros.zarr")
```

Raises:

```
/Users/dstansby/software/zarr/hackathon/.venv/lib/python3.12/site-packages/zarr/creation.py:614: UserWarning: ignoring keyword argument 'read_only'
  compressor, fill_value = _kwargs_compat(compressor, fill_value, kwargs)
```

**Anything else we need to know?**:

**Environment**:

- Dask version: 2024.11.2
- zarr version: 2.18.3
- Python version: 3.12
- Operating System: macOS
- Install method (conda, pip, source): pip
Allow overriding BoundField class on forms and fields
Description
	 
It would be useful if there was an easy way to add CSS classes to the HTML element which is generated when rendering a BoundField. I propose adding field_css_class, similar to required_css_class and error_css_class. ​https://docs.djangoproject.com/en/5.0/ref/forms/api/#styling-required-or-erroneous-form-rows
Something like this has already been rejected in the past here: https://code.djangoproject.com/ticket/29189 . As I understand it the reason for the rejection was the upcoming templates-based form rendering and not really the feature itself. I may have missed the point though.
However, I still think there'd be some value in this even though we have templates-based renderers now. The div (in the case of the div renderer) is generated here: ​https://github.com/django/django/blob/main/django/forms/templates/django/forms/div.html , so it's not just about overriding django/forms/field.html if you want to avoid adding another nesting level. Also, css_classes exists and is documented.
Code-wise I propose extending the css_classes method as follows:
​https://github.com/django/django/blob/e2428292abaca4758a7508175d31667fe2dff57c/django/forms/boundfield.py#L220-L231
		 extra_classes = set(extra_classes or [])
+		if hasattr(self.form, "field_css_class"):
+			extra_classes.add(self.form.field_css_class)
		 if self.errors and hasattr(self.form, "error_css_class"):
I'm willing to do the work if this is accepted.
Allow overriding BoundField class on forms and fields
Description
	 
It would be useful if there was an easy way to add CSS classes to the HTML element which is generated when rendering a BoundField. I propose adding field_css_class, similar to required_css_class and error_css_class. ​https://docs.djangoproject.com/en/5.0/ref/forms/api/#styling-required-or-erroneous-form-rows
Something like this has already been rejected in the past here: https://code.djangoproject.com/ticket/29189 . As I understand it the reason for the rejection was the upcoming templates-based form rendering and not really the feature itself. I may have missed the point though.
However, I still think there'd be some value in this even though we have templates-based renderers now. The div (in the case of the div renderer) is generated here: ​https://github.com/django/django/blob/main/django/forms/templates/django/forms/div.html , so it's not just about overriding django/forms/field.html if you want to avoid adding another nesting level. Also, css_classes exists and is documented.
Code-wise I propose extending the css_classes method as follows:
​https://github.com/django/django/blob/e2428292abaca4758a7508175d31667fe2dff57c/django/forms/boundfield.py#L220-L231
		 extra_classes = set(extra_classes or [])
+		if hasattr(self.form, "field_css_class"):
+			extra_classes.add(self.form.field_css_class)
		 if self.errors and hasattr(self.form, "error_css_class"):
I'm willing to do the work if this is accepted.
[BUG] Object of type Url is not JSON serializable
**Describe the bug**
django-ninja = "^1.3.0"

Using `HttpUrl` (or, I suspect, any *Url class) for a schema used in a response results in json serialization error. This is the same type of issue as #717.

```pytb
Traceback (most recent call last):
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/operation.py", line 121, in run
    return self._result_to_response(request, result, temporal_response)
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/operation.py", line 278, in _result_to_response
    return self.api.create_response(
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/main.py", line 453, in create_response
    content = self.renderer.render(request, data, response_status=status)
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/renderers.py", line 25, in render
    return json.dumps(data, cls=self.encoder_class, **self.json_dumps_params)
  File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/ninja/responses.py", line 28, in default
    return super().default(o)
  File "/home/adys/.cache/pypoetry/virtualenvs/fabrile-backend-fklT6p4J-py3.10/lib/python3.10/site-packages/django/core/serializers/json.py", line 106, in default
    return super().default(o)
  File "/usr/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Url is not JSON serializable
```
RuntimeError with LyCORIS, Batch Inference and skip_guidance_layers
### Describe the bug

A `RuntimeError` occurs when using the following combination:

* SD3 
* Batch inference (`num_images_per_prompt > 1`)
* LyCORIS 
* `skip_guidance_layers` is set

The error message is: `"RuntimeError: The size of tensor a (2) must match the size of tensor b (4) at non-singleton dimension 0"`

It seems that batch inference (`num_images_per_prompt > 1`) does not work in conjunction with `skip_guidance_layers`.


### Reproduction

This code snippet produces the error:

```python
self.pipe = StableDiffusion3Pipeline.from_pretrained(
    "stabilityai/stable-diffusion-3-medium-diffusers", 
    torch_dtype=torch.bfloat16
    )

self.pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
    self.pipe.scheduler.config,
    timestep_spacing="trailing",
    shift=3.0
    )
self.pipe.to("cuda")

lora_scale = 1.0
wrapper, _ = create_lycoris_from_weights(lora_scale, my_lora, self.pipe.transformer)
wrapper.merge_to()

image = self.pipe(
    prompt=request.prompt,
    num_inference_steps=request.num_inference_steps,
    num_images_per_prompt=2,  # Batch inference
    output_type="pil",
    generator=torch.Generator(device="cuda").manual_seed(42),
    guidance_scale=request.guidance_scale,
    width=request.width,
    height=request.height,
    skip_guidance_layers=[7, 8, 9],  # Doesn't seem to work with batching
).images[0]
```

Commenting out `skip_guidance_layers` resolves the error.

**Expected behavior**

Batch inference should work correctly even when `skip_guidance_layers` is used with LyCORIS.



### Logs

_No response_

### System Info

**Environment**

*  CUDA Version: 12.4
*  Python version: 3.12.1 (main, Jan 11 2024, 10:22:40) [GCC 10.2.1 20210110]
*  Diffusers version: https://github.com/huggingface/diffusers.git@99c0483b67427de467f11aa35d54678fd36a7ea2
*  The specific LyCORIS model and inference method used from Bghira: https://huggingface.co/bghira/sd35m-photo-mixedres-cL-sS3-noOverride?not-for-all-audiences=true

### Who can help?

@sayakpaul
How to Add PEFT to PPO Trainer or PPO Config
I am trying to realize RLHF through PPO.

May I ask how can I realize PEFT in RLHF/PPO. I can see this parameter in DPOTrainer. However, I cannot see that in PPOTrainer.
[Feature]: CI - Split up "Models Test" and "Vision Language Models Test"
### 🚀 The feature, motivation and pitch

Takes 1 hour+ on CI compared to others, which take <~30 min. Thus, ends up being a bottleneck

So, should be split up similar to kernels

CC: @khluu
Support Snowflake WITH TAG syntax
**Is your feature request related to a problem? Please describe.**
This library does not support snowflake's WITH TAG syntax for setting tags while creating an object.

For example,
```
sqlglot.parse_one("CREATE VIEW my_view WITH TAG (my_tag = 'tag')", dialect="snowflake")
'CREATE VIEW my_view WITH TAG (my_tag = 'tag')' contains unsupported syntax. Falling back to parsing as a 'Command'.
> Command(this=CREATE, expression=VIEW my_view WITH TAG (my_tag = 'tag'))
```
Note that multiple tags can be specified in the same statement.

**Describe the solution you'd like**
Parse the above statement into something like:
```
Create(
  this=Table(
    this=Identifier(this=my_view, quoted=False)),
  kind=VIEW,
  actions=[tag=[
        Paren(
          this=EQ(
            this=Column(
              this=Identifier(this=my_tag, quoted=False)),
            expression=Literal(this=tag, is_string=True)))])
  ]
)
```
This was pulled from an `ALTER VIEW ... SET TAG` statement, idk if this is actually the correct Create object. My primary desire is to avoid the Command parsing fallback.

**Additional context**
Snowflake CREATE TABLE reference: https://docs.snowflake.com/en/sql-reference/sql/create-table
Example CREATE WAREHOUSE statement: https://docs.snowflake.com/en/user-guide/object-tagging

There are similar `WITH ...` syntaxes in snowflake, e.g. `WITH ROW ACCESS POLICY` and `WITH AGGREGATION POLICY`, or `WITH MASKING POLICY` and `WITH PROJECTION POLICY` for columns. This feature request is not specifically asking for support for that syntax.
Undesired host redirect with trailing slash and host path 
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

If a "hostname" path is provided with a trailing slash, streamlit will respond with a redirect to the host in the path.
Example url (streamlit running locally):  `http://localhost:8501//authorization.site/`
This will 301 redirect to `authorization.site`
This is undesired behavior and can lead to phishing attacks when an trusted hostname redirects to a malicious page.

This was introduced in the [1.39.0 release](https://github.com/streamlit/streamlit/releases/tag/1.39.0) by https://github.com/streamlit/streamlit/pull/9500



### Reproducible Code Example

_No response_

### Steps To Reproduce

1. Request a path against a streamlit server version 1.39.0 with the format `{server_hostname}//{redirect_hostname}/`, eg (http://localhost:8501//authorization.site/)
2. Observe the redirect to the redirect_hostname

### Expected Behavior

Expected behavior is for the server to return a 403 Forbidden response, and this was the behavior in streamlit release version `1.38.0`
Example Request for Streamlit 1.38.0:
```
curl -v http://localhost:8080//authorization.site/
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET //authorization.site/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 403 Forbidden
< Server: TornadoServer/6.4.1
< Content-Type: text/html; charset=UTF-8
< Date: Sun, 20 Oct 2024 17:49:24 GMT
< Content-Length: 69
< Vary: Accept-Encoding
< 
* Connection #0 to host localhost left intact
<html><title>403: Forbidden</title><body>403: Forbidden</body></html>%  
```

### Current Behavior

Curl response when requesting against Streamlit version 1.39.0:
```
curl -v http://localhost:8080//authorization.site/
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET //authorization.site/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 301 Moved Permanently
< Server: TornadoServer/6.4.1
< Content-Type: text/html; charset=UTF-8
< Date: Sun, 20 Oct 2024 17:30:50 GMT
< Location: //authorization.site
< Content-Length: 0
< Vary: Accept-Encoding
< 
* Connection #0 to host localhost left intact
 ```

### Is this a regression?

- [X] Yes, this used to work in a previous version.

### Debug info

- Streamlit version: 1.39.0
- Python version: 3.9
- Operating System: MacOs 
- Browser: Curl


### Additional Information

_No response_
Add `wait` utility for `PrefectFuture`s
Add a `wait` utility that mirrors `concurrent.futures.wait`. Should accept an iterable of futures to wait for completion and a timeout. It should return a tuple of futures that have completed and those that have not yet completed.
Slowdown in `__repr__` due to `n_nodes_per_face` construction triggering
When printing a `Grid`, there is an unnecessary trigger to the `n_nodes_per_face` variable, which has a noticeable impact on performance for larger grids.
Optimize Lexer Performance with Token Caching and Pattern Combining
## Description  
The lexer can be optimized to improve performance and reduce memory usage. This task focuses on implementing token caching, combining similar regex patterns, and caching compiled patterns.  

### Proposed Changes  
1. **Token Caching**  
   - Add a `token_cache` dictionary to reuse frequently used tokens.  
   - Introduce a `_get_cached_token` helper method to manage the cache.  

2. **Combined Regex Patterns**  
   - Group similar patterns (e.g., numbers, vectors, matrices) into combined regex patterns.  
   - Add a `COMBINED_PATTERNS` dictionary to simplify and speed up token matching.  

3. **Pattern Precompilation**  
   - Cache compiled regex patterns to avoid recompilation.  
   - Add a `_compile_patterns` method for one-time regex compilation and store patterns in `REGEX_CACHE`.  

## Files to Modify  
[crosstl/translator/lexer.py](https://github.com/CrossGL/crosstl/blob/main/crosstl/translator/lexer.py)  

---  

@NripeshN, I would love to work on this task. Let me know if it sounds good!  

<!-- BOT_STATE: {"assignee": "Swish78", "assigned_at": "2024-12-26T13:56:30.681969+00:00", "reminder_sent": false, "unassigned": false} -->
Switch to values() instead of select_related
**Version**
all
**Describe the bug**
Some queries use select_related, if we do not need the model instance, we could just use values() that will produce queryset dict results instead.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.  Please provide links to any previous discussions via Discourse or Bugzilla.

During publish metadata generation load just one Artifact checksum type
**Version**
all

**Describe the bug**
There is an overhead which consists in loading all artifact checksum types during publish repodata generation. It's enough to load just one, the one specified in package_checksum_type

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.  Please provide links to any previous discussions via Discourse or Bugzilla.