File size: 3,520 Bytes
476cd78 376d81b 476cd78 376d81b 15b0049 376d81b 48c1024 376d81b 48c1024 376d81b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
---
license: apache-2.0
language:
- en
pipeline_tag: zero-shot-classification
---
# GLiNER-large-v2.1-bird
![gliner bird logo](gliner-bird-logo.png)
Welcome to the repository for the `gliner-large-v2.1-bird` model, a fine-tuned version of the GLiNER `gliner_large-v2.1` targeting specific types of data related to the descriptions of birds. This model enhances the capability to recognize detailed aspects of avian life, particularly focusing on their nesting and dietary habits.
## Model Description
The `gliner-large-v2.1-bird` model is fine-tuned on synthetic data specifically created to capture the nuances of avian dietary and nesting behaviors. The original model, available at [GLiNER GitHub](https://github.com/urchade/GLiNER), has been adapted to better understand texts describing birds, by recognizing and categorizing specific labels related to food sources and nesting locations.
## Labels
This model recognizes the following labels, with each category described below:
- **GENERIC_PLANT_FOOD**: Refers to generic categories of plant-based food sources mentioned in bird descriptions.
- **GENERIC_ANIMAL_FOOD**: Includes broader categories of animal-based food sources.
- **PLANT_FOOD**: Specific types of plant food.
- **SPECIFIC_ANIMAL_FOOD**: Specific types of animal-based food sources mentioned, such as insects and types of fish.
- **LOCATION_NEST**: Describes the typical nesting locations of birds.
- **ITEM_NEST**: Items used by birds to construct their nests.
## Sample Data
Here is a sample from the dataset used for training the model:
```json
{
"text": "The Alpine Swift primarily consumes flying insects such as wasps, bees, and flies. This bird captures its prey mid-air while swiftly flying through the alpine skies. It nests in high, rocky mountain crevices where it uses feathers and small sticks to construct a simple yet secure nesting environment.",
"generic_plant_food": [],
"generic_animal_food": ["flying insects"],
"plant_food": [],
"specific_animal_food": [
"wasps",
"bees",
"flies"
],
"location_nest": [
"rocky mountain crevices"
],
"item_nest": [
"feathers",
"small sticks"
]
}
```
## Usage
This model can be used with the GLiNER library which should be installed via pip as shown below:
```bash
!pip install gliner
```
After installing the GLiNER library, you can use it to predict entities in texts related to bird descriptions by following these steps:
```python
from gliner import GLiNER
# Initialize GLiNER with the fine-tuned model
model = GLiNER.from_pretrained("wjbmattingly/gliner-large-v2.1-bird")
# Sample text for entity prediction
text = """
The Alpine Swift primarily consumes flying insects such as wasps, bees, and flies. This bird captures its prey mid-air while swiftly flying through the alpine skies. It nests in high, rocky mountain crevices where it uses feathers and small sticks to construct a simple yet secure nesting environment.
"""
# Labels for entity prediction (ensure to use the labels specific to your model's training)
labels = ["GENERIC_PLANT_FOOD", "GENERIC_ANIMAL_FOOD", "PLANT_FOOD", "SPECIFIC_ANIMAL_FOOD", "LOCATION_NEST", "ITEM_NEST"]
# Perform entity prediction
entities = model.predict_entities(text, labels, threshold=0.5)
# Display predicted entities and their labels
for entity in entities:
print(entity["text"], "=>", entity["label"])
``` |