File size: 30,116 Bytes
161f4ca a22e3bc 1728550 161f4ca a22e3bc 1728550 45a1fde 1728550 aa69af9 1728550 45a1fde 1728550 e3c1109 1b256a9 a8a68d4 a647848 04e31c6 a647848 1728550 31c6702 1728550 a22e3bc |
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
---
library_name: peft
base_model: NousResearch/Llama-2-7b-hf
license: llama2
datasets:
- DehydratedWater42/semantic_relations_extraction
language:
- en
inference: false
tags:
- math
- semantic
- extraction
- graph
- relations
- science
- synthetic
---
# SeELLama (Semantic Extraction LLama)
Model is based on LLama2-7b and fine-tuned with the `DehydratedWater42/semantic_relations_extraction` dataset.
The purpose of this model is to extract semantic relations from text in a structured way.
#### Simplified Example:
- **Initial Text**: "While there is beautiful weather outside the building, from the window we can see a car. And what's the most annoying, pigeons love to sit on that car."
- **Entities**: ["pigeon", "car", "building"]
- **Relations between entities**: {"pigeon -> car": "pigeon sits on the car", "car -> building": "car is parked outside the building"}
**Note:** The text example above is **too short** for the actual model; please use **at least 500-token text** segments for extraction to avoid hallucinations.
### This is just adapter for `NousResearch/Llama-2-7b-hf`
- **Get SeELLama as Safetensors:** [DehydratedWater42/SeELLama](https://huggingface.co/DehydratedWater42/SeELLama)
- **Get SeELLama as GGUF:** [DehydratedWater42/SeELLama-GGUF](https://huggingface.co/DehydratedWater42/SeELLama-GGUF)
## How to use it:
### Template:
Use the **prompt template** provided below to extract relations from text. Replace `<<your_text_for_extraction>>` with your selected text, ideally between 500-1500 tokens,
with an **optimal range** of about **800-1000 tokens**. You can adjust the **temperature** between 0.3 and 1.0; a good starting point is **between 0.6 and 0.7**.
Temperatures below 0.3 may lead to never ending `section_description`. The higher the temperature, the more the model will fill in the gaps in the provided text.
It was **fine-tuned on scientific articles**, so it will supplement missing information with general knowledge.
Model was trained on 2560 context lenght where 1000-1500 tokens where used as input text.
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
<<your_text_for_extraction>>
### Extracted Relations:
{
"section_description":
```
The `JSON` opening is not necessary but it improves stability. Remember to use double `{{` instead of singular '{' if you are using LangChain prompts with fstring formatting.
## Fine-tuning code/settings
```python
tokenizer = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-hf", trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "right"
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
model = AutoModelForCausalLM.from_pretrained(
"NousResearch/Llama-2-7b-hf",
quantization_config=bnb_config,
use_cache=False,
use_flash_attention_2=False,
device_map="auto",
)
model.config.pretraining_tp = 1
peft_params = LoraConfig(
lora_alpha=16,
lora_dropout=0.1,
r=64,
bias="none",
task_type="CAUSAL_LM",
)
training_params = TrainingArguments(
output_dir="./results",
num_train_epochs=3,
per_device_train_batch_size=1,
gradient_accumulation_steps=1,
optim="paged_adamw_32bit",
save_steps=100,
logging_steps=1,
learning_rate=2e-4,
weight_decay=0.001,
bf16=True,
fp16=False,
tf32=True,
max_grad_norm=0.3,
max_steps=-1,
warmup_ratio=0.03,
group_by_length=True,
lr_scheduler_type="constant",
report_to="mlflow",
run_name="semantic-extraction-llama2-7b"
)
trainer = SFTTrainer(
model=model,
train_dataset=formated_dataset,
peft_config=peft_params,
dataset_text_field="text",
max_seq_length=int(1024 * 2.5), # 2560
tokenizer=tokenizer,
args=training_params,
packing=True,
)
```
### Example:
Extracting information from Minecraft Wiki.
#### Initial template
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
Players in Survival, Adventure, or Spectator have access to the 2×2 crafting grid from their inventory screen. Small crafting recipes that are at most 2×2 can be made there. These include wooden planks, sticks, crafting tables, torches and some shapeless recipes. To craft items using a bigger grid to allow more crafting recipes, create a crafting table with 4 wooden planks, place it in the world, and press use while facing it. This brings up an interface with a larger, 3×3 crafting grid, which the player can use to craft any crafting recipe in the game. There is also a recipe book where the player can access all the crafting recipes.
Some recipes do not require their ingredients to be arranged in a specific way on the crafting grid. These are commonly known as shapeless recipes. For example, players may craft a fermented spider eye by placing its ingredients anywhere within the grid or like a flint and steel can be crafted in any orientation.
On the contrary, many recipes must have their ingredients placed in the correct relative positions on the crafting grid. These are commonly known as shaped recipes. Ingredients in shaped recipes can be ‘moved’ up, down, left, or right. They can also be flipped side-ways. For example, a 3×1 recipe, such as bread, can be made using the top, middle, or bottom row of the 3×3 grid, and a bow may be made with the strings placed on the left instead of on the right.
There are recipes that may not be moved or mirrored in this way. These are commonly known as fixed recipes. For example, dyes in banner recipes - only available in Bedrock Edition - must be specifically placed to achieve the desired pattern. Fixed recipes can be added by data packs, add-ons, or mods.
### Extracted Relations:
{
"section_description":
```
#### Result (about game):
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
Players in Survival, Adventure, or Spectator have access to the 2×2 crafting grid from their inventory screen. Small crafting recipes that are at most 2×2 can be made there. These include wooden planks, sticks, crafting tables, torches and some shapeless recipes. To craft items using a bigger grid to allow more crafting recipes, create a crafting table with 4 wooden planks, place it in the world, and press use while facing it. This brings up an interface with a larger, 3×3 crafting grid, which the player can use to craft any crafting recipe in the game. There is also a recipe book where the player can access all the crafting recipes.
Some recipes do not require their ingredients to be arranged in a specific way on the crafting grid. These are commonly known as shapeless recipes. For example, players may craft a fermented spider eye by placing its ingredients anywhere within the grid or like a flint and steel can be crafted in any orientation.
On the contrary, many recipes must have their ingredients placed in the correct relative positions on the crafting grid. These are commonly known as shaped recipes. Ingredients in shaped recipes can be ‘moved’ up, down, left, or right. They can also be flipped side-ways. For example, a 3×1 recipe, such as bread, can be made using the top, middle, or bottom row of the 3×3 grid, and a bow may be made with the strings placed on the left instead of on the right.
There are recipes that may not be moved or mirrored in this way. These are commonly known as fixed recipes. For example, dyes in banner recipes - only available in Bedrock Edition - must be specifically placed to achieve the desired pattern. Fixed recipes can be added by data packs, add-ons, or mods.
### Extracted Relations:
{
"section_description": "In Minecraft, players can craft items using the 2x2 crafting grid. There are some fixed recipes that require the player to place their ingredients in a specific position.",
"list_of_entities": [
"crafting recipes",
"player",
"fixed recipes",
"2x2 crafting grid",
"survival, adventure, or spectator players",
"wooden planks",
"torches",
"shaped recipes",
"small crafting recipes",
"shapeless recipes",
"wooden planks, sticks, crafting tables, torches",
"flint and steel"
],
"relations": [
{
"description": "Players have access to the 2x2 crafting grid from their inventory screen.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"player"
],
"strength": "strong"
},
{
"description": "Small crafting recipes that are at most 2x2 can be made using the 2x2 crafting grid.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"survival, adventure, or spectator players"
],
"strength": "strong"
},
{
"description": "To craft items using a bigger grid to allow more crafting recipes, create a crafting table with 4 wooden planks, place it in the world, and press use while facing it.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"wooden planks"
],
"strength": "strong"
},
{
"description": "To craft items using a bigger grid to allow more crafting recipes, create a crafting table with 4 wooden planks, place it in the world, and press use while facing it.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"crafting tables"
],
"strength": "strong"
},
{
"description": "Crafting tables allow players to make bigger crafting recipes that are not possible with the 2x2 crafting grid.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"torches",
"flint and steel",
"wooden planks"
],
"strength": "strong"
},
{
"description": "Crafting tables are used to craft items using the 2x2 crafting grid.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"wooden planks, sticks, crafting tables, torches"
],
"strength": "strong"
},
{
"description": "There are some fixed recipes that require the player to place their ingredients in a specific position.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"fixed recipes"
],
"strength": "strong"
},
{
"description": "The recipes do not require their ingredients to be arranged in a specific way on the crafting grid.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"shapeless recipes"
],
"strength": "strong"
},
{
"description": "Ingredients in shapeless recipes can be ‘moved’ up, down, left, or right.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"shaped recipes"
],
"strength": "strong"
},
{
"description": "Ingredients in shaped recipes can be flipped side-ways.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"fixed recipes"
],
"strength": "strong"
},
{
"description": "There are some fixed recipes that require the player to place their ingredients in a specific position.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"fixed recipes"
],
"strength": "strong"
},
{
"description": "The recipes can be added by data packs, add-ons, or mods.",
"source_entities": [
"crafting recipes"
],
"target_entities": [
"fixed recipes"
],
"strength": "strong"
}
]
}
```
### Smaller example (About crafting)
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
Players in Survival, Adventure, or Spectator have access to the 2×2 crafting grid from their inventory screen. Small crafting recipes that are at most 2×2 can be made there. These include wooden planks, sticks, crafting tables, torches and some shapeless recipes. To craft items using a bigger grid to allow more crafting recipes, create a crafting table with 4 wooden planks, place it in the world, and press use while facing it. This brings up an interface with a larger, 3×3 crafting grid, which the player can use to craft any crafting recipe in the game. There is also a recipe book where the player can access all the crafting recipes.
### Extracted Relations:
{
"section_description": "Survival, Adventure, and Spectator players have access to the 2×2 crafting grid. However, to craft items using a bigger grid, you need to create a crafting table with wooden planks, place it in the world, and press use while facing it.",
"list_of_entities": [
"Survival",
"wooden planks",
"Spectator",
"Adventure",
"crafting grid"
],
"relations": [
{
"description": "Survival players can access the 2×2 crafting grid.",
"source_entities": [
"Survival"
],
"target_entities": [
"crafting grid"
],
"strength": "strong"
},
{
"description": "Adventure and Spectator players can also access the 2×2 crafting grid.",
"source_entities": [
"Adventure"
],
"target_entities": [
"crafting grid"
],
"strength": "strong"
},
{
"description": "To craft items using a bigger grid, you need to create a crafting table with wooden planks.",
"source_entities": [
"Spectator"
],
"target_entities": [
"crafting grid"
],
"strength": "strong"
}
]
}
```
### Dopamine example
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
Dopamine is synthesized in a restricted set of cell types, mainly neurons and cells in the medulla of the adrenal glands.[23] The primary and minor metabolic pathways respectively are:
Primary: L-Phenylalanine → L-Tyrosine → L-DOPA → Dopamine[20][21]
Minor: L-Phenylalanine → L-Tyrosine → p-Tyramine → Dopamine[20][21][22]
Minor: L-Phenylalanine → m-Tyrosine → m-Tyramine → Dopamine[22][24][25]
The direct precursor of dopamine, L-DOPA, can be synthesized indirectly from the essential amino acid phenylalanine or directly from the non-essential amino acid tyrosine.[26] These amino acids are found in nearly every protein and so are readily available in food, with tyrosine being the most common. Although dopamine is also found in many types of food, it is incapable of crossing the blood–brain barrier that surrounds and protects the brain.[27] It must therefore be synthesized inside the brain to perform its neuronal activity.[27]
L-Phenylalanine is converted into L-tyrosine by the enzyme phenylalanine hydroxylase, with molecular oxygen (O2) and tetrahydrobiopterin as cofactors. L-Tyrosine is converted into L-DOPA by the enzyme tyrosine hydroxylase, with tetrahydrobiopterin, O2, and iron (Fe2+) as cofactors.[26] L-DOPA is converted into dopamine by the enzyme aromatic L-amino acid decarboxylase (also known as DOPA decarboxylase), with pyridoxal phosphate as the cofactor.[26]
Dopamine itself is used as precursor in the synthesis of the neurotransmitters norepinephrine and epinephrine.[26] Dopamine is converted into norepinephrine by the enzyme dopamine β-hydroxylase, with O2 and L-ascorbic acid as cofactors.[26] Norepinephrine is converted into epinephrine by the enzyme phenylethanolamine N-methyltransferase with S-adenosyl-L-methionine as the cofactor.[26]
Some of the cofactors also require their own synthesis.[26] Deficiency in any required amino acid or cofactor can impair the synthesis of dopamine, norepinephrine, and epinephrine.[26]
Degradation
Dopamine is broken down into inactive metabolites by a set of enzymes—monoamine oxidase (MAO), catechol-O-methyl transferase (COMT), and aldehyde dehydrogenase (ALDH), acting in sequence.[28] Both isoforms of monoamine oxidase, MAO-A and MAO-B, effectively metabolize dopamine.[26] Different breakdown pathways exist but the main end-product is homovanillic acid (HVA), which has no known biological activity.[28] From the bloodstream, homovanillic acid is filtered out by the kidneys and then excreted in the urine.[28] The two primary metabolic routes that convert dopamine into HVA are:[29]
Dopamine → DOPAL → DOPAC → HVA – catalyzed by MAO, ALDH, and COMT respectively
Dopamine → 3-Methoxytyramine → HVA – catalyzed by COMT and MAO+ALDH respectively
In clinical research on schizophrenia, measurements of homovanillic acid in plasma have been used to estimate levels of dopamine activity in the brain. A difficulty in this approach however, is separating the high level of plasma homovanillic acid contributed by the metabolism of norepinephrine.[30][31]
Although dopamine is normally broken down by an oxidoreductase enzyme, it is also susceptible to oxidation by direct reaction with oxygen, yielding quinones plus various free radicals as products.[32] The rate of oxidation can be increased by the presence of ferric iron or other factors. Quinones and free radicals produced by autoxidation of dopamine can poison cells, and there is evidence that this mechanism may contribute to the cell loss that occurs in Parkinson's disease and other conditions.[33]
### Extracted Relations:
{
"section_description": "Dopamine is a neurotransmitter that plays a crucial role in regulating movement, motivation, and reward processing. It is produced in several regions of the brain, including the substantia nigra, ventral tegmental area, and hypothalamus. Dopamine is involved in several physiological functions such as motor control, cognition, and emotional responses. Low levels of dopamine have been linked to several neurological disorders, including Parkinson's disease, schizophrenia, and addiction. Dopamine is also involved in the reward system, which is responsible for motivation and pleasure. The brain's reward system is activated by the release of dopamine in response to pleasurable experiences, such as eating, sex, and drugs. Dopamine is synthesized from the amino acid L-tyrosine, which is derived from dietary sources. The primary precursor of dopamine is L-DOPA, which is synthesized from L-tyrosine by the enzyme tyrosine hydroxylase. Dopamine is then converted into norepinephrine and epinephrine by the enzyme dopamine β-hydroxylase. Dopamine is broken down into inactive metabolites by a set of enzymes, including monoamine oxidase (MAO), catechol-O-methyl transferase (COMT), and aldehyde dehydrogenase (ALDH). The two primary metabolic routes that convert dopamine into HVA are: Dopamine → DOPAL → DOPAC → HVA - catalyzed by MAO, ALDH, and COMT respectively Dopamine → 3-Methoxytyramine → HVA - catalyzed by COMT and MAO+ALDH respectively In clinical research on schizophrenia, measurements of homovanillic acid in plasma have been used to estimate levels of dopamine activity in the brain. A difficulty in this approach however, is separating the high level of plasma homovanillic acid contributed by the metabolism of norepinephrine. Dopamine is also susceptible to oxidation by direct reaction with oxygen, yielding quinones plus various free radicals as products. The rate of oxidation can be increased by the presence of ferric iron or other factors. Quinones and free radicals produced by autoxidation of dopamine can poison cells, and there is evidence that this mechanism may contribute to the cell loss that occurs in Parkinson's disease and other conditions. ",
"list_of_entities": [
"motivation",
"Parkinson's disease",
"cognition",
"pleasure",
"dopamine",
"L-tyrosine",
"schizophrenia",
"emotional responses",
"L-DOPA",
"dopamine β-hydroxylase",
"dopamine β-hydroxylase",
"L-DOPA",
"dopamine",
"L-tyrosine",
"dopamine β-hydroxylase",
"L-DOPA",
"L-tyrosine",
"L-DOPA",
"dopamine",
"L-DOPA",
"dopamine"
],
"relations": [
{
"description": "Dopamine is synthesized from the amino acid L-tyrosine, which is derived from dietary sources.",
"source_entities": [
"dopamine"
],
"target_entities": [
"L-tyrosine"
]
},
{
"description": "The primary precursor of dopamine is L-DOPA, which is synthesized from L-tyrosine by the enzyme tyrosine hydroxylase.",
"source_entities": [
"L-DOPA"
],
"target_entities": [
"dopamine"
]
},
{
"description": "Dopamine is then converted into norepinephrine and epinephrine by the enzyme dopamine β-hydroxylase.",
"source_entities": [
"dopamine"
],
"target_entities": [
"dopamine β-hydroxylase"
]
},
{
"description": "Dopamine is broken down into inactive metabolites by a set of enzymes, including monoamine oxidase (MAO), catechol-O-methyl transferase (COMT), and aldehyde dehydrogenase (ALDH).",
"source_entities": [
"dopamine"
],
"target_entities": [
"monoamine oxidase (MAO)",
"catechol-O-methyl transferase (COMT)",
"aldehyde dehydrogenase (ALDH)"
]
},
{
"description": "The two primary metabolic routes that convert dopamine into HVA are: Dopamine → DOPAL → DOPAC → HVA - catalyzed by MAO, ALDH, and COMT respectively Dopamine → 3-Methoxytyramine → HVA - catalyzed by COMT and MAO+ALDH respectively",
"source_entities": [
"dopamine"
],
"target_entities": [
"HVA",
"MAO",
"ALDH",
"COMT"
]
},
{
"description": "In clinical research on schizophrenia, measurements of homovanillic acid in plasma have been used to estimate levels of dopamine activity in the brain.",
"source_entities": [
"dopamine"
],
"target_entities": [
"homovanillic acid"
]
},
{
"description": "A difficulty in this approach however, is separating the high level of plasma homovanillic acid contributed by the metabolism of norepinephrine.",
"source_entities": [
"homovanillic acid"
],
"target_entities": [
"norepinephrine"
]
},
{
"description": "Dopamine is also susceptible to oxidation by direct reaction with oxygen, yielding quinones plus various free radicals as products.",
"source_entities": [
"dopamine"
],
"target_entities": [
"oxidation"
]
},
{
"description": "The rate of oxidation can be increased by the presence of ferric iron or other factors.",
"source_entities": [
"dopamine"
],
"target_entities": [
"ferric iron"
]
},
{
"description": "Quinones and free radicals produced by autoxidation of dopamine can poison cells, and there is evidence that this mechanism may contribute to the cell loss that occurs in Parkinson's disease and other conditions.",
"source_entities": [
"dopamine"
],
"target_entities": [
"cell loss"
]
}
]
}
```
### Longer example (dirt block)
```text
Below is an part of larger text. Your task is to extract information about entities and relations to the JSON format.
### Text Part to Extract From:
Usage
Using bone meal on grass blocks causes short grass, tall grass,[Java Edition only] ferns,[Bedrock Edition only] and flowers to grow.
Passive mobs tend to wander toward grass blocks. They also wander toward light.
When a sheep eats a grass block, the block becomes dirt, and a sheared sheep regrows its wool. Baby sheep graze grass much more often than adults and mature 1 minute faster when grazing.
Tilling a grass block with a hoe converts it to a farmland block.
Dirt paths can be created by using any type of shovel on the side or top of a grass block with air above it. The shovel loses 1 durability for each dirt path block created.
Death
Grass dies and changes to dirt a random time (when a random tick lands on the block) after it has been covered by any opaque blocks. Transparent blocks can kill grass in a similar manner if they cause the light level above the grass block to be four or below (like water does), and the surrounding area is not otherwise sufficiently illuminated.
Spawning
In Java Edition, animals occasionally spawn on grass blocks that have light level 9 or brighter in the space directly above. This is quite rare and requires that there be few other animals nearby or in the spawn chunks. Most animals are instead created along with the terrain.
In Bedrock Edition, most animals require surface grass blocks (grass blocks with no solid block anywhere above them at the same x, z coordinate) to spawn. Animals regularly spawn in most Overworld biomes on surface grass blocks that have light level 7 or brighter in the space directly above.
Snowy grass block
A snowy grass block with snow on top of it.
Grass blocks turn into a snowy grass block if snow, powder snow or a snow block is placed on top of the block. Removing the snow layer turns the block into a normal grass block.
Composting
In Bedrock Edition, placing grass blocks into a composter has a 30% chance of raising the compost level by 1.
### Extracted Relations:
{
"section_description": "The article discusses the various ways in which grass blocks can be used in Minecraft, including as food, fuel, and protection. It also covers how grass blocks can be used to tame animals, and the dangers of being exposed to grass. The article concludes by highlighting the importance of knowing how to use and defend against grass blocks.",
"list_of_entities": [
"dirt",
"Minecraft",
"light level",
"animal",
"surface grass blocks",
"Bedrock Edition",
"Java Edition",
"dirt path",
"grass",
"snow",
"snowy grass block",
"opaque blocks",
"sheep",
"composter",
"transparent blocks"
],
"relations": [
{
"description": "Grass blocks are a renewable resource that can be used as a food item.",
"source_entities": [
"Minecraft",
"grass"
],
"target_entities": [
"animal",
"surface grass blocks"
],
"strength": "strong"
},
{
"description": "Grass blocks can be used to tame animals.",
"source_entities": [
"Minecraft",
"grass"
],
"target_entities": [
"animal",
"surface grass blocks"
],
"strength": "strong"
},
{
"description": "Exposure to grass blocks can cause damage to the player's health.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"grass",
"player"
],
"strength": "strong"
},
{
"description": "Placing grass blocks in a composter has a 30% chance of raising the compost level by 1.",
"source_entities": [
"Minecraft",
"grass"
],
"target_entities": [
"composter",
"grass"
],
"strength": "strong"
},
{
"description": "Surface grass blocks are the only ones that can be used to spawn animals.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"surface grass blocks",
"animal"
],
"strength": "strong"
},
{
"description": "Animals regularly spawn in most Overworld biomes on surface grass blocks that have light level 7 or brighter in the space directly above.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"surface grass blocks",
"animal"
],
"strength": "strong"
},
{
"description": "If you walk into the grass without first getting rid of any animals or monsters that are there, they will attack you.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"grass",
"player"
],
"strength": "moderate"
},
{
"description": "Placing grass blocks with snow on top of them turns them into snowy grass blocks.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"snow",
"grass"
],
"strength": "strong"
},
{
"description": "Removing the snow layer turns the block into a normal grass block.",
"source_entities": [
"Minecraft"
],
"target_entities": [
"snowy grass block",
"grass"
],
"strength": "strong"
},
{
"description": "Dirt path blocks can be created by using any type of shovel on the side or top of a grass block with air above it.",
"source_entities": [
"Minecraft",
"grass"
],
"target_entities": [
"dirt path",
"shovel"
],
"strength": "strong"
},
{
"description": "The shovel loses 1 durability for each dirt path block created.",
"source_entities": [
"Minecraft",
"shovel"
],
"target_entities": [
"dirt path",
"shovel"
],
"strength": "moderate"
},
{
"description": "Death grass block dies and changes to dirt a random time (when a random tick lands on the block)",
"source_entities": [
"Minecraft"
],
"target_entities": [
"death grass block",
"dirt"
],
"strength": "strong"
},
{
"description": "Grass can be used to create dirt paths",
"source_entities": [
"Minecraft"
],
"target_entities": [
"grass",
"dirt path"
],
"strength": "strong"
}
]
}
```
## Model Card Contact
[More Information Needed]
### Framework versions
- PEFT 0.10.0 |