mteb/LocBenchRR huggingface dataset:
model.keras format much slower to load
Anyone experiencing unreasonably slow load times when loading a keras-format saved model? I have noticed this repeated when working in ipython, where simply instantiating a model via `Model.from_config` then calling `model.load_weights` is much (several factors) faster than loading a `model.keras` file.

My understanding is the keras format is simply a zip file with the config.json file and weights h5 (iirc) but weirdly enough, there's something not right going on while loading.
DOC: Missing type hint for squeeze method
### Pandas version checks

- [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/)


### Location of the documentation

https://github.com/pandas-dev/pandas/blob/main/pandas/core/generic.py

### Documentation problem

The squeeze method is missing a type hint. 

### Suggested fix for documentation

Adding a type hint to the squeeze method to be consistent with the rest of the code.
Regression: IO[str] not compatible with SupportsWrite[AnyStr]
This code generates a false positive, but type checked cleanly on mypy 1.11:
```py
from typing import IO
from shutil import copyfileobj

f: IO[str]
copyfileobj(f, f)  # Cannot infer type argument 1 of "copyfileobj"
```
I believe the reason is that the definition of `IO.write` changed in typeshed, and this triggered a mypy bug. Here's how `IO.write` is currently defined:
```py
class IO(Iterator[AnyStr]):
    ...
    @abstractmethod
    @overload
    def write(self: IO[bytes], s: ReadableBuffer, /) -> int: ...
    @abstractmethod
    @overload
    def write(self, s: AnyStr, /) -> int: ...
```
BUG in load_weights_from_hdf5_group_by_name
https://github.com/keras-team/keras/blob/5d36ee1f219bb650dd108c35b257c783cd034ffd/keras/src/legacy/saving/legacy_h5_format.py#L521-L525

model.trainable_weights + model.non_trainable_weights references all weights instead of top-level
DOC: Fix docstring typo
### Pandas version checks

- [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/)


### Location of the documentation

https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py

### Documentation problem

The docstring for the __arrow_c_stream__ method in the Series class uses the word "behaviour".

### Suggested fix for documentation

Suggested to rewrite as "behavior", which is the American English spelling, to maintain consistency with the rest of the Pandas codebase.
Add support for models trained using MLX
### Feature request

It would be great if model weights trained and saved through MLX could be easily loaded using the Transformers library. This way, MLX users and Transformers users can more freely collaborate when making open source models.


### Motivation

Currently, Transformers only supports safetensors files with metadata for format in `["pt", "tf", "flax"]`. If Transformers can add `"mlx"` to the list, and if MLX can add `metadata={"format":"mlx"}` when saving safetensors, this can be achieved.

Here is a related issue I created on the `mlx_lm` side:
https://github.com/ml-explore/mlx/issues/743#issuecomment-1965427589

Here is a related PR on the `mlx_lm` repo: https://github.com/ml-explore/mlx-examples/pull/496

### Your contribution

I can send a PR to modify the exact code shortly after.
Wrong permission asserts on materialize endpoints 
## Expected Behavior 
The `assert_permissions` function expects a `resources` of type `FeastObject`.

## Current Behavior
Materialization endpoints in `feature_server` module receive instead a `str`, as in [/materialize](https://github.com/feast-dev/feast/blob/60fbc62080950549f28b9411e00926be168bea56/sdk/python/feast/feature_server.py#L256-L258) and [/materialize_incremental](https://github.com/feast-dev/feast/blob/60fbc62080950549f28b9411e00926be168bea56/sdk/python/feast/feature_server.py#L269-L271)

## Possible Solution
Fetch the `FeatureView`s like the [/write-to-online-store](https://github.com/feast-dev/feast/blob/60fbc62080950549f28b9411e00926be168bea56/sdk/python/feast/feature_server.py#L226C9-L235C14) endpoint
Wrong tensor index for roll and truncate in DPOTrainer fn concatenated_forward( ).
### System Info

it is a tensor index error

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder
- [ ] My own task or dataset (give details below)

### Reproduction

```python
# Get the first column idx that is all zeros and remove every column after that
empty_cols = torch.sum(attention_mask, dim=0) == 0
first_empty_col = torch.nonzero(empty_cols)[0].item() if empty_cols.any() else attention_mask.size(1) + 1
input_ids = input_ids[:, : first_empty_col - 1]
attention_mask = attention_mask[:, : first_empty_col - 1]
loss_mask = loss_mask[:, : first_empty_col - 1]
```

### Expected behavior

The returns of _torch.nonzero_ is the index (starts from 0) of non-zero elements, so there is no need to add -1 to _first_empty_col_. 
The correct code should be:
```python
empty_cols = torch.sum(attention_mask, dim=0) == 0
first_empty_col = torch.nonzero(empty_cols)[0].item() if empty_cols.any() else attention_mask.size(1)
input_ids = input_ids[:, : first_empty_col]
attention_mask = attention_mask[:, : first_empty_col]
loss_mask = loss_mask[:, : first_empty_col]
```
DOC: Examples in docstrings – tracking issue
"Examples, more examples, and more detailed examples" is the recurrent theme in the feedback about the NumPy documentation we received via the 2020 and 2021 NumPy user surveys. 

If you come across a docstring where a function is missing an example or more/better examples are needed, please add a comment below.

**Re: the “sprintable” label** This could be a good activity for a sprint with new contributors as most of them are NumPy users. However, one doesn’t have to be a sprint participant to contribute to this initiative.
CLI: Update `prefect deploy` options to support a `--jv/job-variable` option 
### First check

- [X] I am a contributor to the Prefect codebase

### Description

In https://github.com/PrefectHQ/prefect/pull/12195/ we introduced a new option to `prefect deployment run` called `--jv/--job-variable` for providing job variables. This is out of sync with the `prefect`deploy` command's `--v/--variable` flag but the new flags are clearer to use. 



### Impact

If we migrate the command options on `prefect deploy` to use `--jv/--job-variable` we will remain consistent and improve the CLI interface's clarity. 

### Additional context

N/A
Optimize post-migrate permission creation
Description
		
(last modified by Adam Johnson)		
I have often seen django.contrib.auth.management.create_permissions() take a significant amount of time in test run profiles. It can be optimized by batching more of its operations, including making ContentTypeManager.get_for_models() use batch creation.
For a comparison, I profiled 1518 of Django’s tests in modules called “models”:
$ python -m cProfile -o profile runtests.py --parallel 1 *model*
$ python -m pstats profile <<< 'sort cumtime
stats 10000' | less
Before optimization stats:
Total 11,938,857 function calls taking 5.349 seconds.
88 calls to create_permissions() take 456ms, ~8.5% of the total time.
After optimization stats:
Total 11,359,071 function calls taking 5.035 seconds.
88 calls to create_permissions() now take 239ms, ~4.7% of the toal time.
217ms and 579,786 function calls saved.
Optimization is limited because the post_migrate signal runs once per migrated app config, so there’s no chance to bulk create *all* content types and permissions at once. If we introduced a new “all migrated apps” signal, that could reduce runtime further by batching all creation.
`kedro --version` isn't working 
## Description
Reported by @noklam, since adding lazy loading of Kedro subcommands, the `--version`/`-V` option isn't working. 

## Context
This bug is originating in Kedro 0.19.7 -> https://github.com/kedro-org/kedro/pull/3883
`flet build` fails to parse file and git dependencies from `tool.poetry.dependencies` in `pyproject.toml`
### Discussed in https://github.com/flet-dev/flet/discussions/4546

<div type='discussions-op-text'>

<sup>Originally posted by **amcraig** December 11, 2024</sup>
### Question

Hi all, 
I've tried including my python package(not on PyPi) through both relative paths to the whl/tar.gz and via git in both `requirements.txt` and in `pyproject.toml` (including poetry) but any attempts I do fail due to a `distutils Module not found` error or `KeyError: 'version'`.

Does anyone have a guaranteed way to provide a local/private python package to Flet in the build process?
Thanks!

### Code sample

```python
##### Pyproject Poetry 
[tool.poetry]
name = "file_tracker"
version = "0.5.0"
description = "redacted"
authors = ["amcraig"]

[tool.poetry.dependencies]
python = "^3.10"
private_package = { git = "https://github.com/private/package.git" }
flet = "^0.25.1"

##### requirements.txt
python==3.10
flet
datateam @ git+https://github.com/private/package
```


### Error message

_No response_

### ------------------------------------------------------

- [X] I have searched for answers to my question both in the issues and in previous discussions.</div>
`flet build` fails to parse file and git dependencies from `tool.poetry.dependencies` in `pyproject.toml`
### Discussed in https://github.com/flet-dev/flet/discussions/4546

<div type='discussions-op-text'>

<sup>Originally posted by **amcraig** December 11, 2024</sup>
### Question

Hi all, 
I've tried including my python package(not on PyPi) through both relative paths to the whl/tar.gz and via git in both `requirements.txt` and in `pyproject.toml` (including poetry) but any attempts I do fail due to a `distutils Module not found` error or `KeyError: 'version'`.

Does anyone have a guaranteed way to provide a local/private python package to Flet in the build process?
Thanks!

### Code sample

```python
##### Pyproject Poetry 
[tool.poetry]
name = "file_tracker"
version = "0.5.0"
description = "redacted"
authors = ["amcraig"]

[tool.poetry.dependencies]
python = "^3.10"
private_package = { git = "https://github.com/private/package.git" }
flet = "^0.25.1"

##### requirements.txt
python==3.10
flet
datateam @ git+https://github.com/private/package
```


### Error message

_No response_

### ------------------------------------------------------

- [X] I have searched for answers to my question both in the issues and in previous discussions.</div>
Remove `prefect deployment apply` CLI from the `main` branch
Remove the `prefect.cli.deployment.apply` function and any references to it. Any private code that was used solely for that function should also be deleted. This CLI command will be included in 2.x releases, but will not be included in the 3.0 release.
[RFC]: Add Goodput Metric to Benchmark Serving
### Motivation.

Currently, all metrics vLLM has are more from the perspectives of GenAI Service Providers. 

In order to provide a measurement from the perspectives of GenAI Service Users, we, from [Hao AI Lab](https://hao-ai-lab.github.io/home/#:~:text=Welcome%20to%20the%20UCSD%20Hao%20AI%20Lab%20website!), propose a new user-defined metric, **Goodput**😎.

For more context, see the google docs link in the following section.⬇️

### Proposed Change.

Doc: [Goodput Support Proposal with more details.](https://docs.google.com/document/d/1TcZS-igoZxPrD8rj6_NM-WmCiQwAvP_-JJf2mXZEyZY/edit?usp=sharing)

TL; DR - While doing benchmark, users can define service level objectives and get a **Goodput** result. We also propose adding **Goodput** to the CI benchmark dashboard.

### Feedback Period.

3~5 bussiness days

### CC List.

@zhisbug @youkaichao @KuntaiDu @WoosukKwon @ywang96 

### Any Other Things.

_No response_

### Before submitting a new issue...

- [X] Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the [documentation page](https://docs.vllm.ai/en/latest/), which can answer lots of frequently asked questions.
`TimedOut` task has no duration or end time
### Bug summary

 Using the following sample flow to produce a `TimedOut` task and flow, the flow run receives a duration and end time but the task run does not.

```python
from prefect import flow, task
import requests

@task(timeout_seconds=5)
def timeout_task():
    requests.get("http://httpbin.org/delay/10")

@flow
def timeout_flow():
    timeout_task()


if __name__ == "__main__":
    timeout_flow()
```

<img width="2159" alt="image" src="https://github.com/user-attachments/assets/a3fab759-1f78-40c9-ad94-f930b681dcfc">

<img width="416" alt="image" src="https://github.com/user-attachments/assets/4c37ae94-bf54-48ae-9e29-8102901c4414">


### Version info

```Text
Version:             3.1.0
API version:         0.8.4
Python version:      3.12.4
Git commit:          a83ba39b
Built:               Thu, Oct 31, 2024 12:43 PM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         cloud
Pydantic version:    2.9.1
```


### Additional context

_No response_
deprecate scalar conversions for rank>0 arrays
Numpy allows for conversion of arrays into scalars if they are  size-1, i.e.,
```python
float(numpy.array(1.0))  # 1.0
float(numpy.array([1.0]))  # 1.0
float(numpy.array([[[[1.0]]]]))  # 1.0

# TypeError: only size-1 arrays can be converted to Python scalars
float(numpy.array([1.0, 1.0]))
```
I'm fine with rank-0 conversions, but I found that discrimination of conversion based on array size can easily lead to inconsistencies downstream. See, for example, https://github.com/sympy/sympy/issues/13924 where suddenly you have a different behavior of multiplication depending on the length of the input array.

Moreover, this feature is actually redundant for rank>0 arrays since the value can simply be retrieved from the array via `x[0]`.

When grepping for `"converted to Python scalar"` in the numpy sources, one finds that `numpy/lib/user_array.py` has
```
"only rank-0 arrays can be converted to Python scalars."
```
which seems to be the more consistent solution.

I would hence like to suggest to deprecate scalar conversion for rank>0 size-1 arrays.
KMS get_public_key fails with alias
Hi, 

The following test, trying to use `get_public_key` with an alias is failing:

```python
import boto3
from moto import mock_aws

@mock_aws
def test():
    kms = boto3.client("kms", region_name="eu-west-1")
    key = kms.create_key(
        KeyUsage="SIGN_VERIFY",
        KeySpec="ECC_NIST_P256",
    )
    key_id = key["KeyMetadata"]["KeyId"]
    kms.create_alias(
        AliasName="alias/foo",
        TargetKeyId=key_id,
    )
    kms.get_public_key(KeyId="alias/foo")
```
raises the following exception:
```
/Users/xxx/Library/Caches/pypoetry/virtualenvs/motoreport-c38uzrXm-py3.11/bin/python /Users/xxx/PycharmProjects/cebidhem/motoReport/report/main.py 
Traceback (most recent call last):
  File "/Users/xxx/PycharmProjects/cebidhem/motoReport/report/main.py", line 18, in main
    kms.get_public_key(KeyId="alias/foo")
  File "/Users/xxx/Library/Caches/pypoetry/virtualenvs/motoreport-c38uzrXm-py3.11/lib/python3.11/site-packages/botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/Library/Caches/pypoetry/virtualenvs/motoreport-c38uzrXm-py3.11/lib/python3.11/site-packages/botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.NotFoundException: An error occurred (NotFoundException) when calling the GetPublicKey operation: Invalid keyId alias/foo
```

Somehow, the alias isn't recognized as an alias or it doesn't get translated as the actual keyId.

The only place where I can find the error `Invalid keyId ` is in the `_validate_cmk_id(self, key_id: str)`, which seems weird considering I try to use an alias.

I'm using: 
- Python 3.11.1
- moto 5.0.22
- boto3 1.35.75

I can also confirm that it works normally outside of moto with real AWS calls.
Replace shutil.copy with shutil.copyfile
shutil.copy copies permission bits which fails when the user who's running the script is trying to use a common cache that was generated by another user, even though the first user has read & write permissions over the cache (through Group permission for example). A real case scenario: submitting jobs on a GPU cluster accessed by multiple users with common cache directory to reduce disk and network usage.

https://github.com/huggingface/diffusers/blob/0d1d267b12e47b40b0e8f265339c76e0f45f8c49/src/diffusers/utils/dynamic_modules_utils.py#L328

Suggested solution: replace shutil.copy by shutil.copyfile which doesn't copy ownership.
[2pt] Too long "Install package" task
I have 100 Tarantool instances in a cluster. When I deploy them via ansible-cartridge, it takes a very long time to complete the "Install package" task, since it is performed for each instance. Moreover, this task is performed even despite the fact that it is written in the logs that task is skipped for all instances.

Let's define the host list once instead of a hundred times.
[2pt] Too long "Install package" task
I have 100 Tarantool instances in a cluster. When I deploy them via ansible-cartridge, it takes a very long time to complete the "Install package" task, since it is performed for each instance. Moreover, this task is performed even despite the fact that it is written in the logs that task is skipped for all instances.

Let's define the host list once instead of a hundred times.
Prevent attempting to setup data layer on every call toget_data_layer() when no data layer's defined.
**Is your feature request related to a problem? Please describe.**

Currently, the `get_data_layer()` function attempts to set up the data layer on every call, even when no data layer is defined. This can lead to unnecessary checks and potential performance issues if the setup logic is executed repeatedly.

**Describe the solution you'd like**

Modify the `get_data_layer()` function to return early if the `_data_layer` is already set. This prevents re-initialization by checking if `_data_layer` is `None` before attempting to set it up. The current implementation already includes this logic:

```python
def get_data_layer():
    global _data_layer

    if not _data_layer:
        if api_key := os.environ.get("LITERAL_API_KEY"):
            from .literalai import LiteralDataLayer

            # support legacy LITERAL_SERVER variable as fallback
            server = os.environ.get("LITERAL_API_URL") or os.environ.get(
                "LITERAL_SERVER"
            )
            _data_layer = LiteralDataLayer(api_key=api_key, server=server)

    return _data_layer
```

**Describe alternatives you've considered**

We should discriminate between there intentionally not being a data layer setup and there being a default data layer (e.g. LiteralAI). Perhaps we could add a 'null' data layer or something similar?

An alternative could be to refactor the data layer setup logic into a separate initialization function that is explicitly called once during application startup, rather than being embedded within `get_data_layer()`.

**Additional context**

The current implementation already prevents re-initialization by checking if `_data_layer` is `None` before setting it up. If `_data_layer` is already initialized, it simply returns the existing instance <sup>[[1]](https://github.com/Chainlit/chainlit/blob/main/backend/chainlit/data/__init__.py)</sup>. Just when no data layer is used, it will run this logic every time `get_data_layer()` is called.
Too many open file descriptors
Hi, I was using sisyphus today for a big recipe and I got an error in my worker which claimed `too many open files`:

```
OSError: [Errno 24] Unable to synchronously open file (unable to open file: name = <filename>, errno = 24, error message = 'Too many open files', flags = 0, o_flags = 0)
```

However, not only had the worker crashed, but also the manager crashed with this error. Moreover, the terminal (tmux pane) entered a state where every character I typed was converted into a newline character. As a result, I couldn't type any instruction, so I ended up killing the tmux pane and recreating it.

I got into an investigation of what was happening and I developed a really small test:

```
# test.py

def py():
    pass
```

I found out that running the sisyphus manager on the test (bare; without any `settings.py`) opened ~3k files, from my baseline of 524 opened files to 3254 opened files after running `sis m test.py`, according to `lsof | grep <user> | wc`.

Besides that, I had the issue that every job triggered by the manager was adding exactly 105 opened files to the list of open file descriptors. However, I can't reproduce this starting from scratch, which leads me to think that it might be a problem about how our code base interacts with sisyphus (or just from our code base). I'll keep investigating and keep you tuned.

Is this issue about opening too many files by sisyphus intended because of some sisyphus caching strategy or related work? Was this ever addressed?

If you need more details, I'll be glad to provide them. Thank you in advance.
Add support for a `--stdin-filename` cli option
### Search before asking

- [X] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.


### Description

Tools such as `black` and `ruff` support a `--stdin-filename` option for interpreting configuration options when passing file contents via stdin. I'd suggest adding something similar to this to improve functionality with the vscode-sqlfluff extension.

### Use case

Currently, the usage with the vscode-sqlfluff extension requires passing the contents of the file to the sqlfluff cli via stdin. This removes a number of expected configurations based on the file's location. The `--stdin-filename` option would allow reenabling those configurations as if stdin was a file in that location.

### Dialect

All

### Are you willing to work on and submit a PR to address the issue?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)