# spatel1709/kdsh25 architecture

> Architecture diagram of the GitHub repository spatel1709/kdsh25, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spatel1709/kdsh25
- Repository: https://github.com/spatel1709/kdsh25

## Overview

##### Main Components
- Model Artifact & Configuration:
- Training and Fine-tuning Scripts:
- Components for training routines (train_params.py), fine-tuning routines (llama_lora.py, multi.py) and additional modifications (layer_freezing.py, add_classification.py). These scripts adjust the pre-trained model based on the hackathon requirements.
- Data Processing Modules:
- Scripts such as feature_extraction.py which likely extract and preprocess features used in training.
- Supporting JSON files (chunks.json, embeddings.json) that may serve as intermediary data representations or configuration driving data flows.
- References & Documentation:
- Although not part of the runtime, the “Reference” folder housing academic papers contributes context to the design. You might include a “Research & References” component that supports the choice of algorithms and techniques.
- External Dependencies/Inference:
- Optionally, if the model is deployed or integrated into an application, include an “External Services” or “Client Applications” component which might interact with the trained model (even if not explicitly in the file tree, it is a common extension for full-functioning systems).

##### Relationships and Interactions
- Data flow starting from Data Processing (feature_extraction.py) leading into the training pipeline.
- That the training flow (train_params.py, llama_lora.py, multi.py) utilizes configurations and parameters defined in JSON files and from “Fined_tuned_model”.
- That modifications (add_classification.py, layer_freezing.py) adjust the model architecture or training strategy as needed.

##### Architectural Patterns and Design Principles
- Modularity: Each Python script forms a modular part of the training/fine-tuning pipeline.
- Separation of concerns: Configuration, training logic, feature extraction, and model adaptations are all in separate components.
- Configuration-driven design: The use of JSON configuration files points to a flexible, configurable setup.
- If applicable, note that some components might be run sequentially or in a pipeline, reflecting typical data-science workflows.

##### Relevant Technologies and Frameworks
- Given the model configuration files and script names (e.g., llama_lora.py), it’s likely that frameworks like PyTorch or TensorFlow are involved along with specific libraries for model fine-tuning (possibly the Hugging Face Transformers library).
- The JSON and Python ecosystem indicate a dynamic, script-driven environment typical for experimental machine learning projects.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Processing Modules
    subgraph "Data Processing Modules"
        FP["feature_extraction.py"]:::processing
        CJ["chunks.json"]:::processing
        EJ["embeddings.json"]:::processing
    end

    %% Training & Fine-tuning Scripts
    subgraph "Training & Fine-tuning Scripts"
        TP1["train_params.py"]:::training
        TP2["llama_lora.py"]:::training
        TP3["multi.py"]:::training
    end

    %% Model Adaptation Scripts
    subgraph "Model Adaptation Scripts"
        MA1["add_classification.py"]:::adaptation
        MA2["layer_freezing.py"]:::adaptation
    end

    %% Model Artifact & Configuration
    subgraph "Model Artifact & Configuration"
        MC["Fined_tuned_model"]:::config
        AC["adapter_config.json"]:::config
        GC["generation_config.json"]:::config
        TC["tokenizer.json"]:::config
        TCC["tokenizer_config.json"]:::config
        ST["special_tokens_map.json"]:::config
    end

    %% Research & References
    subgraph "Research & References"
        RR["Reference"]:::research
        NPR["Non-Publishable"]:::research
        PR["Publishable"]:::research
    end

    %% Relationships and Data Flow
    FP --> TP1
    MC --> TP1
    RR --> TP1
    TP1 --> TP2
    TP2 --> TP3
    TP3 --> MA1
    MA1 --> MA2
    MA2 --> MC

    %% Click Events
    click FP "https://github.com/spatel1709/kdsh25/blob/main/feature_extraction.py"
    click CJ "https://github.com/spatel1709/kdsh25/blob/main/chunks.json"
    click EJ "https://github.com/spatel1709/kdsh25/blob/main/embeddings.json"

    click TP1 "https://github.com/spatel1709/kdsh25/blob/main/train_params.py"
    click TP2 "https://github.com/spatel1709/kdsh25/blob/main/llama_lora.py"
    click TP3 "https://github.com/spatel1709/kdsh25/blob/main/multi.py"

    click MA1 "https://github.com/spatel1709/kdsh25/blob/main/add_classification.py"
    click MA2 "https://github.com/spatel1709/kdsh25/blob/main/layer_freezing.py"

    click MC "https://github.com/spatel1709/kdsh25/tree/main/Fined_tuned_model"
    click AC "https://github.com/spatel1709/kdsh25/blob/main/Fined_tuned_model/adapter_config.json"
    click GC "https://github.com/spatel1709/kdsh25/blob/main/Fined_tuned_model/generation_config.json"
    click TC "https://github.com/spatel1709/kdsh25/blob/main/Fined_tuned_model/tokenizer.json"
    click TCC "https://github.com/spatel1709/kdsh25/blob/main/Fined_tuned_model/tokenizer_config.json"
    click ST "https://github.com/spatel1709/kdsh25/blob/main/Fined_tuned_model/special_tokens_map.json"

    click RR "https://github.com/spatel1709/kdsh25/tree/main/Reference"
    click NPR "https://github.com/spatel1709/kdsh25/tree/main/Reference/Non-Publishable"
    click PR "https://github.com/spatel1709/kdsh25/tree/main/Reference/Publishable"

    %% Styles
    classDef processing fill:#F08080,stroke:#000,stroke-width:1px;
    classDef training fill:#FFFFE0,stroke:#000,stroke-width:1px;
    classDef adaptation fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef config fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef research fill:#DDA0DD,stroke:#000,stroke-width:1px;
```
