Instructions to use temmam/mistral-7b-academic-metadata-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use temmam/mistral-7b-academic-metadata-extractor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="temmam/mistral-7b-academic-metadata-extractor") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("temmam/mistral-7b-academic-metadata-extractor") model = AutoModelForCausalLM.from_pretrained("temmam/mistral-7b-academic-metadata-extractor", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use temmam/mistral-7b-academic-metadata-extractor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "temmam/mistral-7b-academic-metadata-extractor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "temmam/mistral-7b-academic-metadata-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/temmam/mistral-7b-academic-metadata-extractor
- SGLang
How to use temmam/mistral-7b-academic-metadata-extractor with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "temmam/mistral-7b-academic-metadata-extractor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "temmam/mistral-7b-academic-metadata-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "temmam/mistral-7b-academic-metadata-extractor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "temmam/mistral-7b-academic-metadata-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use temmam/mistral-7b-academic-metadata-extractor with Docker Model Runner:
docker model run hf.co/temmam/mistral-7b-academic-metadata-extractor
Mistral-7B Academic Metadata Extractor
A fine-tuned Mistral-7B-Instruct-v0.3 model for structured metadata extraction from academic documents.
The model extracts metadata from academic text and produces structured JSON output.
Extracted Metadata
The model extracts the following fields:
- Title
- Keywords
- Authors
- Affiliations
- Publisher
- Journal
- Publication Year
Performance
The fine-tuned model achieved an overall field-level accuracy of 91.8% on the test set.
| Metadata Field | Accuracy |
|---|---|
| Title | 98% |
| Keywords | 85% |
| Authors | 96% |
| Affiliations | 93% |
| Publisher | 90% |
| Journal | 88% |
| Year | 87% |
| Overall | 91.8% |
Training Dataset
A dataset of 10,000 academic PDF documents was prepared for the project.
The final dataset was divided into:
- Training: 9,000 documents
- Validation: 900 documents
- Testing: 100 documents
Approximately 3,000 documents were manually reviewed to complete or correct missing metadata fields.
Training Configuration
| Parameter | Value |
|---|---|
| Base Model | Mistral-7B-Instruct-v0.3 |
| Fine-Tuning Method | LoRA |
| Epochs | 3 (early stopping at 1.97) |
| Batch Size | 2 |
| Learning Rate | 2e-5 |
| Maximum Sequence Length | 1024 tokens |
| GPU | NVIDIA A100 80 GB |
| CPUs per Task | 6 |
| Framework | Unsloth + Hugging Face |
Output Format
The model is designed to return metadata in JSON format:
{
"title": "",
"keywords": [],
"authors": [
{
"name": "",
"affiliations": [""]
}
],
"publisher": "",
"year": "",
"journal": ""
}
Research
This model was developed as part of the research:
Developing AI Agents That Extract Metadata Using The RAG Method With Fine-Tuned Large Language Models
Authors: Tamam Alhasan and SavaÅŸ Takan
Affiliation: Artificial Intelligence and Data Engineering Department, Ankara University
The research compared RAG-based metadata extraction with supervised fine-tuning. Mistral-7B-Instruct-v0.3 achieved 74.43% overall accuracy in the RAG setup, while the fine-tuned model improved the overall accuracy to 91.8%.
Intended Use
This model is intended for extracting structured bibliographic metadata from academic and scientific documents.
Potential applications include:
- Academic repositories
- Digital libraries
- Research databases
- Automated document indexing
- Scientific knowledge management
Limitations
The model was trained and evaluated primarily on English-language academic documents. Performance may vary for documents with unusual layouts, incomplete metadata, OCR errors, or domains significantly different from the training data.
Authors
Tamam Alhasan
Artificial Intelligence and Data Engineering
Ankara University, Türkiye
- Downloads last month
- -
Model tree for temmam/mistral-7b-academic-metadata-extractor
Base model
mistralai/Mistral-7B-v0.3