--- 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"]) ```