Downloads · 30 days
4
3% of all-time downloads
akkasali663/companies-house-tinyllama
companies-house-tinyllama is a text generation model from akkasali663. Use it when you need the model to write or continue text. It is set up for transformers.
Fine-tuning a TinyLlama Model for Companies House Data Extraction
Downloads · 30 days
4
3% of all-time downloads
All-time downloads
142
Public
Parameters
1.1B
2.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 100%
From the Hugging Face model README
Fine-tuning a TinyLlama Model for Companies House Data Extraction
TinyLlama 1.1B Chat v1.0
This project fine-tunes the TinyLlama 1.1B Chat v1.0 model to perform structured data extraction from UK Companies House records. The goal is to train the model to recognize and complete specific patterns within the company record text, making it capable of generating structured outputs like JSON or completing partial records.
Key Libraries and Techniques Used:
SFTTrainer was used for Supervised Fine-Tuning. This trainer simplifies the process of training models on instruction-following or structured text generation tasks.Fine-tuning Process:
Data Preparation: The Companies House data (in JSON Lines format with a 'text' field) is loaded and processed. A custom formatting function is applied to structure the data for training. Depending on the training objective, this involves:
Model Loading & LoRA Adaptation: The base TinyLlama model is loaded in a 4-bit quantized format using Unsloth. LoRA adapters are then applied to specific layers of the model (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj) to enable efficient fine-tuning.
Training Execution: The SFTTrainer is configured with hyperparameters (learning rate, batch size, epochs, etc.) and the prepared dataset. The trainer manages the training loop, updating the LoRA adapter weights based on the training objective. Techniques like gradient accumulation and gradient checkpointing (optimized by Unsloth) are used to handle larger batch sizes and sequence lengths within limited GPU memory.
Model Merging: After training, the trained LoRA adapter weights are merged back into the base model. This creates a single, standalone model file that can be easily loaded and used for inference without needing the original base model separately. Unsloth's save_pretrained_merged method handles this merging process efficiently, often supporting different output formats (e.g., 16-bit).
Evaluation: The fine-tuned model is evaluated using metrics like Perplexity (for CLM tasks) or by performing sample inferences to qualitatively assess its ability to generate the desired structured output and adhere to the learned format and delimiters.
Deployment Preparation (Optional): The merged model can be converted to other formats like GGUF using tools like llama.cpp or Unsloth's export functions, enabling deployment on various hardware and platforms, including consumer-grade CPUs/GPUs via libraries like llama.cpp or tools like Ollama.
This process leverages state-of-the-art techniques and libraries to efficiently adapt a pre-trained language model to a specific domain and task, resulting in a smaller, more specialized model capable of structured data extraction. This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]