huggingface / peft

🤗 PEFT: State-of-the-art Parameter-Efficient Fine-Tuning.
https://huggingface.co/docs/peft
Apache License 2.0
16.46k stars 1.62k forks source link

FIX Type annoations in vera/bnb.py #2139

Closed BenjaminBossan closed 1 month ago

BenjaminBossan commented 1 month ago

The file was missing the from __future__ import annotations part. As this code is only running nightly with GPU, the normal CI missed this omission. With this PR, nightly CI should be green again.

When I tested it locally with GPU, I didn't check with Python 3.8, so this error did not occur. Once we stop supporting Python 3.8 very soon, this will also no longer be necessary, but we still need to fix it until then.

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

BenjaminBossan commented 1 month ago

TIL! How does this affect?

When you have code like:

def foo(x: list[str]):
    pass

This normally requires Python 3.9+ or you need to use from typing import List and use List[str]. However, with the __future__ import, you can use the type annotation syntax from Python 3.9+ inside of Python 3.8.

sayakpaul commented 1 month ago

Thanks for clarifying!