wjbmattingly commited on
Commit
376d81b
1 Parent(s): 8c34d80

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md CHANGED
@@ -1,3 +1,88 @@
1
  ---
2
  license: apache-2.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: zero-shot-classification
6
  ---
7
+
8
+ # GLiNER-large-v2.1-bird
9
+
10
+ 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.
11
+
12
+ ## Model Description
13
+
14
+ 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.
15
+
16
+ ## Labels
17
+
18
+ This model recognizes the following labels, with each category described below:
19
+
20
+ - **GENERIC_PLANT_FOOD**: Refers to generic categories of plant-based food sources mentioned in bird descriptions. *(This model currently does not use this label due to the specific focus on the described dataset.)*
21
+
22
+ - **GENERIC_ANIMAL_FOOD**: Includes broader categories of animal-based food sources.
23
+
24
+ - **PLANT_FOOD**: Specific types of plant food. *(This model currently does not use this label due to the specific focus on the described dataset.)*
25
+
26
+ - **SPECIFIC_ANIMAL_FOOD**: Specific types of animal-based food sources mentioned, such as insects and types of fish.
27
+
28
+ - **LOCATION_NEST**: Describes the typical nesting locations of birds.
29
+
30
+ - **ITEM_NEST**: Items used by birds to construct their nests.
31
+
32
+ ## Sample Data
33
+
34
+ Here is a sample from the dataset used for training the model:
35
+
36
+ ```json
37
+ {
38
+ "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.",
39
+ "generic_plant_food": [],
40
+ "generic_animal_food": ["flying insects"],
41
+ "plant_food": [],
42
+ "specific_animal_food": [
43
+ "wasps",
44
+ "bees",
45
+ "flies"
46
+ ],
47
+ "location_nest": [
48
+ "rocky mountain crevices"
49
+ ],
50
+ "item_nest": [
51
+ "feathers",
52
+ "small sticks"
53
+ ]
54
+ }
55
+ ```
56
+
57
+
58
+ ## Usage
59
+
60
+ This model can be used with the GLiNER library which should be installed via pip as shown below:
61
+
62
+ ```bash
63
+ !pip install gliner
64
+ ```
65
+
66
+ After installing the GLiNER library, you can use it to predict entities in texts related to bird descriptions by following these steps:
67
+
68
+ ```python
69
+ from gliner import GLiNER
70
+
71
+ # Initialize GLiNER with the fine-tuned model
72
+ model = GLiNER.from_pretrained("wjbmattingly/gliner-large-v2.1-bird")
73
+
74
+ # Sample text for entity prediction
75
+ text = """
76
+ 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.
77
+ """
78
+
79
+ # Labels for entity prediction (ensure to use the labels specific to your model's training)
80
+ labels = ["GENERIC_PLANT_FOOD", "GENERIC_ANIMAL_FOOD", "PLANT_FOOD", "SPECIFIC_ANIMAL_FOOD", "LOCATION_NEST", "ITEM_NEST"]
81
+
82
+ # Perform entity prediction
83
+ entities = model.predict_entities(text, labels, threshold=0.5)
84
+
85
+ # Display predicted entities and their labels
86
+ for entity in entities:
87
+ print(entity["text"], "=>", entity["label"])
88
+ ```