Skip to content

Commit 92850f4

Browse files
authored
Merge pull request #336 from urchade/restructuring
Restructure the repo / update documentation
2 parents c26744b + 5408975 commit 92850f4

4 files changed

Lines changed: 31 additions & 6 deletions

File tree

docs/instalation.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,26 @@ To use `FlashDeBERTa` with GLiNER, install it:
8686
pip install flashdeberta -U
8787
```
8888
:::tip
89-
Before using FlashDeBERTa, please make sure that you have `transformers>=4.47.0`.
89+
Before using FlashDeBERTa, please make sure that you have `transformers>=4.51.3`.
9090
:::
9191

92-
GLiNER will automatically detect and use `FlashDeBERTa`. If needed, you can switch to the standard `eager` attention mechanism by specifying the attention implementation:
92+
To enable FlashDeBERTa, set the `USE_FLASHDEBERTA` environment variable before loading the model:
93+
94+
```bash
95+
export USE_FLASHDEBERTA=1
96+
```
97+
98+
Or set it directly in Python:
99+
100+
```python
101+
import os
102+
os.environ["USE_FLASHDEBERTA"] = "1"
103+
104+
from gliner import GLiNER
105+
model = GLiNER.from_pretrained("urchade/gliner_mediumv2.1")
106+
```
107+
108+
If needed, you can switch to the standard `eager` attention mechanism by specifying the attention implementation:
93109

94110
```python
95111
model = GLiNER.from_pretrained("urchade/gliner_mediumv2.1", _attn_implementation="eager")

docs/usage.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,20 +484,29 @@ pip install flashdeberta -U
484484
```
485485

486486
:::tip
487-
Before using FlashDeBERTa, please make sure that you have `transformers>=4.47.0`.
487+
Before using FlashDeBERTa, please make sure that you have `transformers>=4.51.3`.
488488
:::
489489

490490
### Usage
491491

492-
GLiNER will automatically detect and use FlashDeBERTa. If needed, you can switch to the standard `eager` attention mechanism:
492+
To enable FlashDeBERTa, set the `USE_FLASHDEBERTA` environment variable before loading the model:
493+
494+
```bash
495+
export USE_FLASHDEBERTA=1
496+
```
497+
498+
Or set it directly in Python:
493499

494500
```python
501+
import os
502+
os.environ["USE_FLASHDEBERTA"] = "1"
503+
495504
from gliner import GLiNER
496505

497-
# Use FlashDeBERTa (automatic if installed)
506+
# FlashDeBERTa will be used when USE_FLASHDEBERTA is set and the package is installed
498507
model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1")
499508

500-
# Or explicitly use eager attention
509+
# To explicitly use eager attention instead
501510
model = GLiNER.from_pretrained(
502511
"urchade/gliner_medium-v2.1",
503512
_attn_implementation="eager"

0 commit comments

Comments
 (0)