YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

Quantization made by Richard Erkhov.

Github

Discord

Request more models

Papy_1_Llama-3.1-8B-Instruct_date - GGUF

Original model description:

license: apache-2.0 datasets: - Ericu950/Papyri_1 base_model: - meta-llama/Meta-Llama-3.1-8B-Instruct library_name: transformers tags: - papyrology - epigraphy - philology

Papy_1_Llama-3.1-8B-Instruct_date

This is a fine-tuned version of the Llama-3.1-8B-Instruct model, specialized in assigning a date to Greek documentary papyri. On a test set of 2,295 unseen papyri its predictions were, on average, 21.7 years away from the actual date spans. See https://arxiv.org/abs/2409.13870.

Dataset

This model was finetuned on the Ericu950/Papyri_1 dataset, which consists of Greek documentary papyri editions and their corresponding dates and geographical attributions sourced from the amazing Papyri.info.

Usage

To run the model on a GPU with large memory capacity, follow these steps:

1. Download and load the model

import json
from transformers import pipeline, AutoTokenizer, LlamaForCausalLM
import torch
model_id = "Ericu950/Papy_1_Llama-3.1-8B-Instruct_date"
model = LlamaForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
generation_pipeline = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto",
)

2. Run inference on a papyrus fragment of your choice

# This is a rough transcription of Pap.Ups. 106
papyrus_edition = """
ฮตฯ„ฮฟฯ…ฯƒ ฯ„ฮตฯ„ฮฑฯฯ„ฮฟฯ… ฮฑฯ…ฯ„ฮฟฮบฯฮฑฯ„ฮฟฯฮฟฯƒ ฮบฮฑฮนฯƒฮฑฯฮฟฯƒ ฮฟฯ…ฮตฯƒฯ€ฮฑฯƒฮนฮฑฮฝฮฟฯ… ฯƒฮตฮฒฮฑฯƒฯ„ฮฟฯ… ------------------ 
ฮฟฮผฮฟฮปฮฟฮณฮตฮน ฯ€ฮฑฯ…ฯƒฮนฯฮนฯ‰ฮฝ ฮฑฯ€ฮฟฮปฮปฯ‰ฮฝฮนฮฟฯ… ฯ„ฮฟฯ… ฯ€ฮฑuฯƒฮนฯฮนฯ‰ฮฝฮฟฯƒ ฮผฮทฯ„ฯฮฟฯƒ ---------------ฯ„ฯ‰ฮน ฮณฮตฮณฮฟฮฝฮฟฯ„ฮน ฮฑฯ…ฯ„ฯ‰ฮน 
ฮตฮบ ฯ„ฮทฯƒ ฮณฮตฮฝฮฟฮผฮตฮฝฮทฯƒ ฮบฮฑฮน ฮผฮตฯ„ฮทฮปฮปฮฑฯ‡ฯ…ฮนฮฑฯƒ ฮฑฯ…ฯ„ฮฟฯ… ฮณฯ…ฮฝฮฑฮนฮบฮฟฯƒ ------------------------- 
ฮฑฯ€ฮฟ ฯ„ฮทฯƒ ฮฑฯ…ฯ„ฮทฯƒ ฯ€ฮฟฮปฮตฯ‰ฯƒ ฮตฮฝ ฮฑฮณฯ…ฮนฮฑฮน ฯƒฯ…ฮณฯ‡ฯ‰ฯฮตฮนฮฝ ฮตฮนฮฝฮฑฮน ---------------------------------- 
--------------------ฯƒ ฮฑฯ…ฯ„ฯ‰ฮน ฮตฮพ ฮทฯƒ ฯƒฯ…ฮฝฮตฯƒฯ„ฮนฮฝ ------------------------------------ 
----ฯ„ฮทฯƒ ฮฑฯ…ฯ„ฮทฯƒ ฮณฮตฮฝฮตฮฑฯƒ ฯ„ฮทฮฝ ฯ…ฯ€ฮฑฯฯ‡ฮฟฯ…ฯƒฮฑฮฝ ฮฑฯ…ฯ„ฯ‰ฮน ฮฟฮนฮบฮนฮฑฮฝ ------------ 
------------------ ---------ฮบฮฑแฝถ ฮฑฮนฮธฯฮนฮฟฮฝ ฮบฮฑฮน ฮฑฯ…ฮปฮท ฮฑฯ€ฮตฯ ฮฟ ฯ…ฮนฮฟฯƒ ฮดฮนฮฟฮบฮฟฯฮฟฯƒ -------------------------- 
--------ฮตฮณฯฮฑฯˆฮตฮฝ ฯ„ฮฟฯ… ฮด ฮฑฯ…ฯ„ฮฟฯ… ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯ… ฮตฮนฮฝฮฑฮน ------------------------------------ 
---------- ฮบฮฑฮน ฯ€ฯฮฟ ฮบฮฑฯ„ฮตฮฝฮณฮตฮณฯ…ฮทฯ„ฮฑฮน ฯ„ฮฑ ฮดฮนฮบฮฑฮนฮฑ -------------------------------------- 
ฮฝฮทฯƒ ฮบฮฑฯ„ฮฑ ฯ„ฮฟฯ…ฯƒ ฯ„ฮทฯƒ ฯ‡ฯ‰ฯฮฑฯƒ ฮฝฮฟฮผฮฟฯ…ฯƒยท ฮตฮฑฮฝ ฮดฮต ฮผฮท --------------------------------------- 
ฯ…ฯ€ ฮฑฯ…ฯ„ฮฟฯ… ฯ„ฮทฮน ฯ„ฮฟฯ… ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯ… ฯƒฮทฮผฮฑฮนฮฝฮฟฮผฮตฮฝฮทฮน -----------------------------------ฮตฮฝฮฟฮนฮบฮนฯƒฮผฯ‰ฮน ฯ„ฮฟฯ… 
ฮทฮผฮนฯƒฮฟฯ…ฯƒ ฮผฮตฯฮฟฯ…ฯƒ ฯ„ฮทฯƒ ฯ€ฯฮฟฮบฮตฮนฮผฮตฮฝฮทฯƒ ฮฟฮนฮบฮนฮฑฯƒ --------------------------------- ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯƒ ฯ„ฮทฮฝ ฯ„ฮฟฯ…ฯ„ฯ‰ฮฝ ฮฑฯ€ฮฟฯ‡ฮทฮฝ 
---------------------------------------------ฮผฮทฮด ฯ…ฯ€ฮตฮฝฮฑฮฝฯ„ฮนฮฟฮฝ ฯ„ฮฟฯ…ฯ„ฮฟฮนฯƒ ฮตฯ€ฮนฯ„ฮตฮปฮตฮนฮฝ ฮผฮทฮดฮต 
------------------------------------------------ ฮฑฮฝฮฑฯƒฮบฮตฯ…ฮทฮน ฮบฮฑฯ„ ฮฑฯ…ฯ„ฮทฯƒ ฯ„ฮนฮธฮตฯƒฮธฮฑฮน ฮฟฮผฮฟฮปฮฟฮณฮนฮฑฮฝ ฮผฮทฮดฮต 
----------------------------------- ฮตฯ€ฮนฯ„ฮตฮปฮตฯƒฮฑฮน ฮท ฯ‡ฯ‰ฯฮนฯƒ ฯ„ฮฟฯ… ฮบฯ…ฯฮนฮฑ ฮตฮนฮฝฮฑฮน ฯ„ฮฑ ฮดฮนฮฟฮผฮฟฮปฮฟฮณฮทฮผฮตฮฝฮฑ 
ฯ€ฮฑฯฮฑฮฒฮฑฮนฮฝฮตฮนฮฝ, ฮตฮบฯ„ฮตฮนฮฝฮตฮนฮฝ ฮดฮต ฯ„ฮฟฮฝ ฯ€ฮฑฯฮฑฮฒฮทฯƒฮฟฮผฮตฮฝฮฟฮฝ ฯ„ฯ‰ฮน ฯ…ฮนฯ‰ฮน ฮดฮนฮฟฯƒฮบฮฟฯฯ‰ฮน ฮท ฯ„ฮฟฮนฯƒ ฯ€ฮฑฯ ฮฑฯ…ฯ„ฮฟฯ… ฮบฮฑฮธ ฮตฮบฮฑฯƒฯ„ฮทฮฝ 
ฮตฯ†ฮฟฮดฮฟฮฝ ฯ„ฮฟ ฯ„ฮต ฮฒฮปฮฑฮฒฮฟฯƒ ฮบฮฑฮน ฮตฯ€ฮนฯ„ฮนฮผฮฟฮฝ ฮฑฯฮณฯ…ฯฮนฮฟฯ… ฮดฯฮฑฯ‡ฮผฮฑฯƒ 0 ฮบฮฑฮน ฮตฮนฯƒ ฯ„ฮฟ ฮดฮทฮผฮฟฯƒฮนฮฟฮฝ ฯ„ฮฑฯƒ ฮนฯƒฮฑฯƒ ฮบฮฑฮน ฮผฮทฮธฮตฮฝ 
ฮทฯƒฯƒฮฟฮฝยท ฮด -----ฮนฯ‰ฮฝ ฮฟฮผฮฟฮปฮฟฮณฮนฮฑฮฝ ฯƒฯ…ฮฝฮตฯ‡ฯ‰ฯฮทฯƒฮตฮฝยท
"""
system_prompt = "Date this papyrus fragment to an exact year!"
input_messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": papyrus_edition},
]
terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = generation_pipeline(
    input_messages,
    max_new_tokens=4,
    num_beams=45, # Set this as high as your memory will allow!
    num_return_sequences=1,
    early_stopping=True,
)
beam_contents = []
for output in outputs:
    generated_text = output.get('generated_text', [])
    for item in generated_text:
        if item.get('role') == 'assistant':
            beam_contents.append(item.get('content'))
real_response = "71 or 72 AD"
print(f"Year: {real_response}")
for i, content in enumerate(beam_contents, start=1):
    print(f"Suggestion {i}: {content}")

Expected Output:

Year: 71 or 72 AD
Suggestion 1: 71

Usage on free tier in Google Colab

If you donโ€™t have access to a larger GPU but want to try the model out, you can run it in a quantized format in Google Colab. The quality of the responses might deteriorate significantly. Follow these steps:

Step 1: Connect to free GPU

  1. Click Connect arrow_drop_down near the top right of the notebook.
  2. Select Change runtime type.
  3. In the modal window, select T4 GPU as your hardware accelerator.
  4. Click Save.
  5. Click the Connect button to connect to your runtime. After some time, the button will present a green checkmark, along with RAM and disk usage graphs. This indicates that a server has successfully been created with your required hardware.

Step 2: Install Dependencies

!pip install -U bitsandbytes
import os
os._exit(00)

Step 3: Download and quantize the model

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, pipeline
import torch
quant_config = BitsAndBytesConfig(
   load_in_4bit=True,
   bnb_4bit_quant_type="nf4",
   bnb_4bit_use_double_quant=True,
   bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained("Ericu950/Papy_1_Llama-3.1-8B-Instruct_date",
device_map = "auto", quantization_config = quant_config)
tokenizer = AutoTokenizer.from_pretrained("Ericu950/Papy_1_Llama-3.1-8B-Instruct_date")
generation_pipeline = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto",
)

Step 4: Run inference on a papyrus fragment of your choice

# This is a rough transcription of Pap.Ups. 106
papyrus_edition = """
ฮตฯ„ฮฟฯ…ฯƒ ฯ„ฮตฯ„ฮฑฯฯ„ฮฟฯ… ฮฑฯ…ฯ„ฮฟฮบฯฮฑฯ„ฮฟฯฮฟฯƒ ฮบฮฑฮนฯƒฮฑฯฮฟฯƒ ฮฟฯ…ฮตฯƒฯ€ฮฑฯƒฮนฮฑฮฝฮฟฯ… ฯƒฮตฮฒฮฑฯƒฯ„ฮฟฯ… ------------------ 
ฮฟฮผฮฟฮปฮฟฮณฮตฮน ฯ€ฮฑฯ…ฯƒฮนฯฮนฯ‰ฮฝ ฮฑฯ€ฮฟฮปฮปฯ‰ฮฝฮนฮฟฯ… ฯ„ฮฟฯ… ฯ€ฮฑuฯƒฮนฯฮนฯ‰ฮฝฮฟฯƒ ฮผฮทฯ„ฯฮฟฯƒ ---------------ฯ„ฯ‰ฮน ฮณฮตฮณฮฟฮฝฮฟฯ„ฮน ฮฑฯ…ฯ„ฯ‰ฮน 
ฮตฮบ ฯ„ฮทฯƒ ฮณฮตฮฝฮฟฮผฮตฮฝฮทฯƒ ฮบฮฑฮน ฮผฮตฯ„ฮทฮปฮปฮฑฯ‡ฯ…ฮนฮฑฯƒ ฮฑฯ…ฯ„ฮฟฯ… ฮณฯ…ฮฝฮฑฮนฮบฮฟฯƒ ------------------------- 
ฮฑฯ€ฮฟ ฯ„ฮทฯƒ ฮฑฯ…ฯ„ฮทฯƒ ฯ€ฮฟฮปฮตฯ‰ฯƒ ฮตฮฝ ฮฑฮณฯ…ฮนฮฑฮน ฯƒฯ…ฮณฯ‡ฯ‰ฯฮตฮนฮฝ ฮตฮนฮฝฮฑฮน ---------------------------------- 
--------------------ฯƒ ฮฑฯ…ฯ„ฯ‰ฮน ฮตฮพ ฮทฯƒ ฯƒฯ…ฮฝฮตฯƒฯ„ฮนฮฝ ------------------------------------ 
----ฯ„ฮทฯƒ ฮฑฯ…ฯ„ฮทฯƒ ฮณฮตฮฝฮตฮฑฯƒ ฯ„ฮทฮฝ ฯ…ฯ€ฮฑฯฯ‡ฮฟฯ…ฯƒฮฑฮฝ ฮฑฯ…ฯ„ฯ‰ฮน ฮฟฮนฮบฮนฮฑฮฝ ------------ 
------------------ ---------ฮบฮฑแฝถ ฮฑฮนฮธฯฮนฮฟฮฝ ฮบฮฑฮน ฮฑฯ…ฮปฮท ฮฑฯ€ฮตฯ ฮฟ ฯ…ฮนฮฟฯƒ ฮดฮนฮฟฮบฮฟฯฮฟฯƒ -------------------------- 
--------ฮตฮณฯฮฑฯˆฮตฮฝ ฯ„ฮฟฯ… ฮด ฮฑฯ…ฯ„ฮฟฯ… ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯ… ฮตฮนฮฝฮฑฮน ------------------------------------ 
---------- ฮบฮฑฮน ฯ€ฯฮฟ ฮบฮฑฯ„ฮตฮฝฮณฮตฮณฯ…ฮทฯ„ฮฑฮน ฯ„ฮฑ ฮดฮนฮบฮฑฮนฮฑ -------------------------------------- 
ฮฝฮทฯƒ ฮบฮฑฯ„ฮฑ ฯ„ฮฟฯ…ฯƒ ฯ„ฮทฯƒ ฯ‡ฯ‰ฯฮฑฯƒ ฮฝฮฟฮผฮฟฯ…ฯƒยท ฮตฮฑฮฝ ฮดฮต ฮผฮท --------------------------------------- 
ฯ…ฯ€ ฮฑฯ…ฯ„ฮฟฯ… ฯ„ฮทฮน ฯ„ฮฟฯ… ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯ… ฯƒฮทฮผฮฑฮนฮฝฮฟฮผฮตฮฝฮทฮน -----------------------------------ฮตฮฝฮฟฮนฮบฮนฯƒฮผฯ‰ฮน ฯ„ฮฟฯ… 
ฮทฮผฮนฯƒฮฟฯ…ฯƒ ฮผฮตฯฮฟฯ…ฯƒ ฯ„ฮทฯƒ ฯ€ฯฮฟฮบฮตฮนฮผฮตฮฝฮทฯƒ ฮฟฮนฮบฮนฮฑฯƒ --------------------------------- ฮดฮนฮฟฯƒฮบฮฟฯฮฟฯƒ ฯ„ฮทฮฝ ฯ„ฮฟฯ…ฯ„ฯ‰ฮฝ ฮฑฯ€ฮฟฯ‡ฮทฮฝ 
---------------------------------------------ฮผฮทฮด ฯ…ฯ€ฮตฮฝฮฑฮฝฯ„ฮนฮฟฮฝ ฯ„ฮฟฯ…ฯ„ฮฟฮนฯƒ ฮตฯ€ฮนฯ„ฮตฮปฮตฮนฮฝ ฮผฮทฮดฮต 
------------------------------------------------ ฮฑฮฝฮฑฯƒฮบฮตฯ…ฮทฮน ฮบฮฑฯ„ ฮฑฯ…ฯ„ฮทฯƒ ฯ„ฮนฮธฮตฯƒฮธฮฑฮน ฮฟฮผฮฟฮปฮฟฮณฮนฮฑฮฝ ฮผฮทฮดฮต 
----------------------------------- ฮตฯ€ฮนฯ„ฮตฮปฮตฯƒฮฑฮน ฮท ฯ‡ฯ‰ฯฮนฯƒ ฯ„ฮฟฯ… ฮบฯ…ฯฮนฮฑ ฮตฮนฮฝฮฑฮน ฯ„ฮฑ ฮดฮนฮฟฮผฮฟฮปฮฟฮณฮทฮผฮตฮฝฮฑ 
ฯ€ฮฑฯฮฑฮฒฮฑฮนฮฝฮตฮนฮฝ, ฮตฮบฯ„ฮตฮนฮฝฮตฮนฮฝ ฮดฮต ฯ„ฮฟฮฝ ฯ€ฮฑฯฮฑฮฒฮทฯƒฮฟฮผฮตฮฝฮฟฮฝ ฯ„ฯ‰ฮน ฯ…ฮนฯ‰ฮน ฮดฮนฮฟฯƒฮบฮฟฯฯ‰ฮน ฮท ฯ„ฮฟฮนฯƒ ฯ€ฮฑฯ ฮฑฯ…ฯ„ฮฟฯ… ฮบฮฑฮธ ฮตฮบฮฑฯƒฯ„ฮทฮฝ 
ฮตฯ†ฮฟฮดฮฟฮฝ ฯ„ฮฟ ฯ„ฮต ฮฒฮปฮฑฮฒฮฟฯƒ ฮบฮฑฮน ฮตฯ€ฮนฯ„ฮนฮผฮฟฮฝ ฮฑฯฮณฯ…ฯฮนฮฟฯ… ฮดฯฮฑฯ‡ฮผฮฑฯƒ 0 ฮบฮฑฮน ฮตฮนฯƒ ฯ„ฮฟ ฮดฮทฮผฮฟฯƒฮนฮฟฮฝ ฯ„ฮฑฯƒ ฮนฯƒฮฑฯƒ ฮบฮฑฮน ฮผฮทฮธฮตฮฝ 
ฮทฯƒฯƒฮฟฮฝยท ฮด -----ฮนฯ‰ฮฝ ฮฟฮผฮฟฮปฮฟฮณฮนฮฑฮฝ ฯƒฯ…ฮฝฮตฯ‡ฯ‰ฯฮทฯƒฮตฮฝยท"""
system_prompt = "Date this papyrus fragment to an exact year!"
input_messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": papyrus_edition},
]
outputs = generation_pipeline(
    input_messages,
    max_new_tokens=4,
    num_beams=10,
    num_return_sequences=1,
    early_stopping=True,
)
beam_contents = []
for output in outputs:
    generated_text = output.get('generated_text', [])
    for item in generated_text:
        if item.get('role') == 'assistant':
            beam_contents.append(item.get('content'))
real_response = "71 or 72 AD"
print(f"Year: {real_response}")
for i, content in enumerate(beam_contents, start=1):
    print(f"Suggestion {i}: {content}")

Expected Output:

Year: 71 or 72 AD
Suggestion 1: 71
Downloads last month
749
GGUF
Model size
8B params
Architecture
llama
Hardware compatibility
Log In to view the estimation

2-bit

3-bit

4-bit

5-bit

6-bit

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support