Spaces:
Running
Running
pareshmishra
commited on
Commit
Β·
fd36f13
1
Parent(s):
2442d6c
changes for python
Browse files
README.md
CHANGED
|
@@ -1,12 +1,151 @@
|
|
| 1 |
---
|
| 2 |
title: MT564AITraining
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: gray
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
short_description: MT564Model training
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: MT564AITraining
|
| 3 |
+
emoji: π
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: gray
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
short_description: MT564Model training
|
| 10 |
+
|
| 11 |
---
|
| 12 |
|
| 13 |
+
|
| 14 |
+
# SWIFT-MT564-Assistant
|
| 15 |
+
Added MT564 TinyLlama training interface
|
| 16 |
+
β Created comprehensive training UI with file upload
|
| 17 |
+
β Integrated horoscope harvesting with MT564 training
|
| 18 |
+
β Both systems running in unified application
|
| 19 |
+
β Navigation links connect both functionalities
|
| 20 |
+
|
| 21 |
+
The application now provides both data harvesting for horoscopes AND MT564 TinyLlama training with a complete UI. You can access the MT564 training interface through the navigation menu.
|
| 22 |
+
|
| 23 |
+
## Project Overview
|
| 24 |
+
|
| 25 |
+
This project creates an AI-powered documentation assistant for financial messaging standards, specifically focused on the SWIFT MT564 message type. It combines web scraping, data processing, TinyLlama fine-tuning, and a user-friendly interface to provide an intelligent assistant for financial messaging professionals.
|
| 26 |
+
|
| 27 |
+
## Key Components
|
| 28 |
+
|
| 29 |
+
### 1. Data Collection & Processing
|
| 30 |
+
|
| 31 |
+
- **Web Scraper**: Extracts structured data from [ISO20022 SWIFT MT564 documentation](https://www.iso20022.org/15022/uhb/finmt564.htm)
|
| 32 |
+
- **PDF Parser**: Extracts text and structural information from uploaded SWIFT documentation PDFs
|
| 33 |
+
- **Data Formatter**: Converts scraped and parsed data into training examples for the model
|
| 34 |
+
|
| 35 |
+
### 2. Model Training Pipeline
|
| 36 |
+
|
| 37 |
+
- **TinyLlama Integration**: Implementation of TinyLlama, a smaller and more efficient LLM
|
| 38 |
+
- **Fine-tuning Scripts**: Specialized scripts for training on SWIFT message documentation
|
| 39 |
+
- **Evaluation Tools**: Methods to test the model's understanding of SWIFT message formats
|
| 40 |
+
|
| 41 |
+
### 3. User Interface
|
| 42 |
+
|
| 43 |
+
- **Web Application**: Flask-based interface for interacting with the model
|
| 44 |
+
- **PDF Upload**: Functionality to upload and process SWIFT documentation PDFs
|
| 45 |
+
- **Question-Answering System**: Interactive chat interface for asking questions about MT564 and related formats
|
| 46 |
+
|
| 47 |
+
## Technical Architecture
|
| 48 |
+
|
| 49 |
+
```
|
| 50 |
+
SWIFT-MT564-Assistant/
|
| 51 |
+
βββ scrapers/ # Web scraping components
|
| 52 |
+
β βββ iso20022_scraper.py # Scraper for ISO20022 website
|
| 53 |
+
β βββ pdf_parser.py # PDF extraction utilities
|
| 54 |
+
β βββ data_processor.py # Converts raw data to training format
|
| 55 |
+
β
|
| 56 |
+
βββ model/ # ML model components
|
| 57 |
+
β βββ tinyllama_trainer.py # Fine-tuning implementation
|
| 58 |
+
β βββ data_formatter.py # Prepares data for training
|
| 59 |
+
β βββ evaluator.py # Tests model performance
|
| 60 |
+
β
|
| 61 |
+
βββ webapp/ # Web application
|
| 62 |
+
β βββ app.py # Flask application
|
| 63 |
+
β βββ templates/ # HTML templates
|
| 64 |
+
β β βββ index.html # Main page
|
| 65 |
+
β β βββ result.html # Results display
|
| 66 |
+
β βββ static/ # CSS, JS, and other static files
|
| 67 |
+
β
|
| 68 |
+
βββ data/ # Data storage
|
| 69 |
+
β βββ raw/ # Raw scraped data
|
| 70 |
+
β βββ processed/ # Processed training data
|
| 71 |
+
β βββ uploaded/ # User-uploaded PDFs
|
| 72 |
+
β
|
| 73 |
+
βββ train_mt564_model.py # Script to train the model
|
| 74 |
+
βββ requirements.txt # Project dependencies
|
| 75 |
+
βββ README.md # Project documentation
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## How It Works
|
| 79 |
+
|
| 80 |
+
1. **Data Collection Phase**:
|
| 81 |
+
- The ISO20022 scraper extracts structured data from the SWIFT MT564 documentation
|
| 82 |
+
- The data is processed and converted into a training dataset of instruction-response pairs
|
| 83 |
+
|
| 84 |
+
2. **Model Training Phase**:
|
| 85 |
+
- TinyLlama is fine-tuned on the specialized SWIFT message format data
|
| 86 |
+
- The model learns the structure, fields, and usage of MT564 messages
|
| 87 |
+
|
| 88 |
+
3. **User Interaction Phase**:
|
| 89 |
+
- Users upload SWIFT documentation PDFs through the web interface
|
| 90 |
+
- The system extracts and processes the PDF content
|
| 91 |
+
- Users ask questions about SWIFT messages and receive accurate, contextual responses
|
| 92 |
+
|
| 93 |
+
## Installation & Setup
|
| 94 |
+
|
| 95 |
+
### Prerequisites
|
| 96 |
+
|
| 97 |
+
- Python 3.8+
|
| 98 |
+
- PyTorch
|
| 99 |
+
- Transformers library
|
| 100 |
+
- Flask
|
| 101 |
+
- PDF processing libraries
|
| 102 |
+
|
| 103 |
+
### Installation Steps
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
# Clone the repository
|
| 107 |
+
git clone <repository-url>
|
| 108 |
+
cd SWIFT-MT564-Assistant
|
| 109 |
+
|
| 110 |
+
# Create a virtual environment
|
| 111 |
+
python -m venv venv
|
| 112 |
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
| 113 |
+
|
| 114 |
+
# Install dependencies
|
| 115 |
+
pip install -r requirements.txt
|
| 116 |
+
|
| 117 |
+
# Download and prepare the model
|
| 118 |
+
python prepare_mt564_data.py
|
| 119 |
+
|
| 120 |
+
# Run the web application
|
| 121 |
+
python main.py
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
## Usage
|
| 125 |
+
|
| 126 |
+
### Training the Model
|
| 127 |
+
|
| 128 |
+
```bash
|
| 129 |
+
# Run the scraper to collect data
|
| 130 |
+
python scrapers/iso20022_scraper.py
|
| 131 |
+
|
| 132 |
+
# Process the data
|
| 133 |
+
python scrapers/data_processor.py
|
| 134 |
+
|
| 135 |
+
# Train the model
|
| 136 |
+
python train_mt564_model.py
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### Using the Web Interface
|
| 140 |
+
|
| 141 |
+
1. Start the Flask application: `python main.py`
|
| 142 |
+
2. Open a browser and navigate to: `http://localhost:5000`
|
| 143 |
+
3. Upload a SWIFT MT564 documentation PDF
|
| 144 |
+
4. Ask questions about the SWIFT message format
|
| 145 |
+
|
| 146 |
+
## Future Enhancements
|
| 147 |
+
|
| 148 |
+
- Expand coverage to additional SWIFT message types (MT565, MT566, etc.)
|
| 149 |
+
- Implement multi-document reasoning across different SWIFT standards
|
| 150 |
+
- Add support for ISO20022 MX message formats
|
| 151 |
+
- Develop specialized modules for message validation and conversion
|