Model Card for Model ID

Model Details

Model Description

This is the model card of a ๐Ÿค— transformers model that has been pushed on the Hub. This model card has been automatically generated.

  • Developed by: [More Information Needed]
  • Funded by [optional]: [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: [More Information Needed]
  • Language(s) (NLP): [More Information Needed]
  • License: [More Information Needed]
  • Finetuned from model [optional]: [More Information Needed]

Model Sources [optional]

  • Repository: [More Information Needed]
  • Paper [optional]: [More Information Needed]
  • Demo [optional]: [More Information Needed]

Uses

Direct Use

TEXT = """

"""

SCHEMA = """

"""

SYSTEM_PROMPT = """
### Role:
You are an expert data extractor specialising in mapping hierarchical text data into a given JSON Schema.

### DATA INPUT:
- **Text:** ```{{TEXT}}```  
- **Empty JSON Schema:** ```{{SCHEMA}}```  

### TASK REQUIREMENT:
1. Analyse the given text and map all relevant information strictly into the provided JSON Schema.
2. Provide your output in **two mandatory sections**:
   - **`<answer>`:** The filled JSON object  
   - **`<think>`:** Reasoning for the mapping decisions  

### OUTPUT STRUCTURE:

`<think> /* Explanation of mapping logic */ </think>`
`<answer> /* Completed JSON Object */ </answer>`

### STRICT RULES FOR GENERATING OUTPUT:
1. **Both Tags Required:**  
   - Always provide both the `<think>` and the `<answer>` sections.  
   - If reasoning is minimal, state: "Direct mapping from text to schema."
2. **JSON Schema Mapping:**  
   - Strictly map the text data to the given JSON Schema without modification or omissions.
3. **Hierarchy Preservation:**  
   - Maintain proper parent-child relationships and follow the schema's hierarchical structure.
4. **Correct Mapping of Attributes:**  
   -Map key attributes, including `displayName`, `description`, `type`, `component`, and source to define the structure, metadata, and data sources for each field within the schema
5. **JSON Format Compliance:**  
   - Escape quotes (`\"`), replace newlines with `\\n`, avoid trailing commas, and use double quotes exclusively.
6. **Step-by-Step Reasoning:**  
   - Explain your reasoning within the `<think>` tag.

### IMPORTANT:
If either the `<think>` or `<answer>` tags is missing, the response will be considered incomplete.
"""
from jinja2 import Template
system_prompt_template = Template(SYSTEM_PROMPT)
system_prompt_str = system_prompt_template.render(TEXT=TEXT, SCHEMA=SCHEMA)
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer, FineGrainedFP8Config
import torch

model_name = "Isotonic/DR1-1.5b-JSON_extraction"

# Initialize tokenizer and model
device = "mps"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map=device)

inputs = tokenizer([system_prompt_str], return_tensors="pt").to(device)
text_streamer = TextStreamer(tokenizer)

with torch.no_grad():
    output_ids = model.generate(
        input_ids=inputs["input_ids"],
        attention_mask=inputs["attention_mask"],
        max_new_tokens=4096,
        temperature=0.6,
        top_p=0.92,
        repetition_penalty=1.1,
        streamer=text_streamer,
        pad_token_id=tokenizer.pad_token_id,
    )

print(tokenizer.decode(output_ids[0], skip_special_tokens=True))

Downstream Use [optional]

[More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

[More Information Needed]

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

Use the code below to get started with the model.

[More Information Needed]

Training Details

Training Data

[More Information Needed]

Training Procedure

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

  • Training regime: [More Information Needed]

Speeds, Sizes, Times [optional]

[More Information Needed]

Evaluation

Testing Data, Factors & Metrics

Testing Data

[More Information Needed]

Factors

[More Information Needed]

Metrics

[More Information Needed]

Results

[More Information Needed]

Summary

Model Examination [optional]

[More Information Needed]

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: [More Information Needed]
  • Hours used: [More Information Needed]
  • Cloud Provider: [More Information Needed]
  • Compute Region: [More Information Needed]
  • Carbon Emitted: [More Information Needed]

Technical Specifications [optional]

Model Architecture and Objective

[More Information Needed]

Compute Infrastructure

[More Information Needed]

Hardware

[More Information Needed]

Software

[More Information Needed]

Citation [optional]

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]

Downloads last month
5
Safetensors
Model size
1.54B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Isotonic/DR1-1.5b-JSON_extraction