Instructions to use ShakhawatShanin/Bangla-Text-Summarization with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use ShakhawatShanin/Bangla-Text-Summarization with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ShakhawatShanin/Bangla-Text-Summarization", filename="Bangla_Text_Summarization/bangla_summarization.Q8_0.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use ShakhawatShanin/Bangla-Text-Summarization with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0 # Run inference directly in the terminal: llama-cli -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0 # Run inference directly in the terminal: llama-cli -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ShakhawatShanin/Bangla-Text-Summarization:Q8_0
Use Docker
docker model run hf.co/ShakhawatShanin/Bangla-Text-Summarization:Q8_0
- LM Studio
- Jan
- Ollama
How to use ShakhawatShanin/Bangla-Text-Summarization with Ollama:
ollama run hf.co/ShakhawatShanin/Bangla-Text-Summarization:Q8_0
- Unsloth Studio new
How to use ShakhawatShanin/Bangla-Text-Summarization with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ShakhawatShanin/Bangla-Text-Summarization to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ShakhawatShanin/Bangla-Text-Summarization to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ShakhawatShanin/Bangla-Text-Summarization to start chatting
- Docker Model Runner
How to use ShakhawatShanin/Bangla-Text-Summarization with Docker Model Runner:
docker model run hf.co/ShakhawatShanin/Bangla-Text-Summarization:Q8_0
- Lemonade
How to use ShakhawatShanin/Bangla-Text-Summarization with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ShakhawatShanin/Bangla-Text-Summarization:Q8_0
Run and chat with the model
lemonade run user.Bangla-Text-Summarization-Q8_0
List all available models
lemonade list
Upload 19 files
Browse files- .gitattributes +2 -0
- Bangla_Text_Summarization/Modelfile.txt +27 -0
- Bangla_Text_Summarization/bangla_summarization.Q8_0.gguf +3 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/README.md +63 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/adapter_config.json +46 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/adapter_model.safetensors +3 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/added_tokens.json +3 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/chat_template.jinja +47 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/preprocessor_config.json +29 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/processor_config.json +4 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/special_tokens_map.json +33 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer.json +3 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer.model +3 -0
- Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer_config.json +0 -0
- Bangla_Text_Summarization/bts_finetune.ipynb +0 -0
- Bangla_Text_Summarization/data.csv +0 -0
- Modelfile +26 -0
- main.py +28 -0
- static/icon.png +0 -0
- templates/index.html +99 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
Bangla_Text_Summarization/bangla_summarization.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
Bangla_Text_Summarization/Modelfile.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM /content/bangla_summarization_model_merged.Q8_0.gguf
|
| 2 |
+
|
| 3 |
+
# Set the model parameters
|
| 4 |
+
PARAMETER num_ctx 2048
|
| 5 |
+
PARAMETER num_batch 512
|
| 6 |
+
PARAMETER num_gpu 1
|
| 7 |
+
|
| 8 |
+
# Template for chat format
|
| 9 |
+
TEMPLATE """<start_of_turn>user
|
| 10 |
+
সংক্ষেপ করুন: {{ .Prompt }}<end_of_turn>
|
| 11 |
+
<start_of_turn>model
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
# System prompt
|
| 15 |
+
SYSTEM """You are a helpful AI assistant specialized in summarizing Bengali text.
|
| 16 |
+
Your task is to create concise, accurate summaries of Bengali articles while preserving the key information and meaning.
|
| 17 |
+
|
| 18 |
+
Always respond in Bengali.
|
| 19 |
+
Keep summaries clear and to the point.
|
| 20 |
+
Focus on the main ideas and important details."""
|
| 21 |
+
|
| 22 |
+
# Model configuration
|
| 23 |
+
PARAMETER temperature 0.1
|
| 24 |
+
PARAMETER top_k 40
|
| 25 |
+
PARAMETER top_p 0.9
|
| 26 |
+
PARAMETER stop "<end_of_turn>"
|
| 27 |
+
PARAMETER repeat_penalty 1.1
|
Bangla_Text_Summarization/bangla_summarization.Q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e6cb247908e9fc841d4698b3b677a9ff86eaf92c755c205235ce4e124b8105a
|
| 3 |
+
size 4130401952
|
Bangla_Text_Summarization/bangla_summarization_adapter/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: unsloth/gemma-3-4b-it-unsloth-bnb-4bit
|
| 3 |
+
library_name: peft
|
| 4 |
+
model_name: bangla_summarization_model
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:unsloth/gemma-3-4b-it-unsloth-bnb-4bit
|
| 7 |
+
- lora
|
| 8 |
+
- sft
|
| 9 |
+
- transformers
|
| 10 |
+
- trl
|
| 11 |
+
- unsloth
|
| 12 |
+
licence: license
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Model Card for bangla_summarization_model
|
| 17 |
+
|
| 18 |
+
This model is a fine-tuned version of [unsloth/gemma-3-4b-it-unsloth-bnb-4bit](https://huggingface.co/unsloth/gemma-3-4b-it-unsloth-bnb-4bit).
|
| 19 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 20 |
+
|
| 21 |
+
## Quick start
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
from transformers import pipeline
|
| 25 |
+
|
| 26 |
+
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
| 27 |
+
generator = pipeline("text-generation", model="None", device="cuda")
|
| 28 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 29 |
+
print(output["generated_text"])
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## Training procedure
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
This model was trained with SFT.
|
| 38 |
+
|
| 39 |
+
### Framework versions
|
| 40 |
+
|
| 41 |
+
- PEFT 0.17.1
|
| 42 |
+
- TRL: 0.22.2
|
| 43 |
+
- Transformers: 4.55.4
|
| 44 |
+
- Pytorch: 2.8.0+cu126
|
| 45 |
+
- Datasets: 3.6.0
|
| 46 |
+
- Tokenizers: 0.21.4
|
| 47 |
+
|
| 48 |
+
## Citations
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
Cite TRL as:
|
| 53 |
+
|
| 54 |
+
```bibtex
|
| 55 |
+
@misc{vonwerra2022trl,
|
| 56 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
| 57 |
+
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
|
| 58 |
+
year = 2020,
|
| 59 |
+
journal = {GitHub repository},
|
| 60 |
+
publisher = {GitHub},
|
| 61 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 62 |
+
}
|
| 63 |
+
```
|
Bangla_Text_Summarization/bangla_summarization_adapter/adapter_config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": {
|
| 4 |
+
"base_model_class": "Gemma3ForConditionalGeneration",
|
| 5 |
+
"parent_library": "transformers.models.gemma3.modeling_gemma3",
|
| 6 |
+
"unsloth_fixed": true
|
| 7 |
+
},
|
| 8 |
+
"base_model_name_or_path": "unsloth/gemma-3-4b-it-unsloth-bnb-4bit",
|
| 9 |
+
"bias": "none",
|
| 10 |
+
"corda_config": null,
|
| 11 |
+
"eva_config": null,
|
| 12 |
+
"exclude_modules": null,
|
| 13 |
+
"fan_in_fan_out": false,
|
| 14 |
+
"inference_mode": true,
|
| 15 |
+
"init_lora_weights": true,
|
| 16 |
+
"layer_replication": null,
|
| 17 |
+
"layers_pattern": null,
|
| 18 |
+
"layers_to_transform": null,
|
| 19 |
+
"loftq_config": {},
|
| 20 |
+
"lora_alpha": 16,
|
| 21 |
+
"lora_bias": false,
|
| 22 |
+
"lora_dropout": 0,
|
| 23 |
+
"megatron_config": null,
|
| 24 |
+
"megatron_core": "megatron.core",
|
| 25 |
+
"modules_to_save": null,
|
| 26 |
+
"peft_type": "LORA",
|
| 27 |
+
"qalora_group_size": 16,
|
| 28 |
+
"r": 16,
|
| 29 |
+
"rank_pattern": {},
|
| 30 |
+
"revision": null,
|
| 31 |
+
"target_modules": [
|
| 32 |
+
"up_proj",
|
| 33 |
+
"o_proj",
|
| 34 |
+
"v_proj",
|
| 35 |
+
"k_proj",
|
| 36 |
+
"q_proj",
|
| 37 |
+
"down_proj",
|
| 38 |
+
"gate_proj"
|
| 39 |
+
],
|
| 40 |
+
"target_parameters": null,
|
| 41 |
+
"task_type": "CAUSAL_LM",
|
| 42 |
+
"trainable_token_indices": null,
|
| 43 |
+
"use_dora": false,
|
| 44 |
+
"use_qalora": false,
|
| 45 |
+
"use_rslora": false
|
| 46 |
+
}
|
Bangla_Text_Summarization/bangla_summarization_adapter/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:537d5c2a66653bc29d9ba05b9c4b2e31f3c037f409830052a3582e3a66097a05
|
| 3 |
+
size 131252288
|
Bangla_Text_Summarization/bangla_summarization_adapter/added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<image_soft_token>": 262144
|
| 3 |
+
}
|
Bangla_Text_Summarization/bangla_summarization_adapter/chat_template.jinja
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}
|
| 2 |
+
{%- if messages[0]['role'] == 'system' -%}
|
| 3 |
+
{%- if messages[0]['content'] is string -%}
|
| 4 |
+
{%- set first_user_prefix = messages[0]['content'] + '
|
| 5 |
+
|
| 6 |
+
' -%}
|
| 7 |
+
{%- else -%}
|
| 8 |
+
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
|
| 9 |
+
|
| 10 |
+
' -%}
|
| 11 |
+
{%- endif -%}
|
| 12 |
+
{%- set loop_messages = messages[1:] -%}
|
| 13 |
+
{%- else -%}
|
| 14 |
+
{%- set first_user_prefix = "" -%}
|
| 15 |
+
{%- set loop_messages = messages -%}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- for message in loop_messages -%}
|
| 18 |
+
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
|
| 19 |
+
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 22 |
+
{%- set role = "model" -%}
|
| 23 |
+
{%- else -%}
|
| 24 |
+
{%- set role = message['role'] -%}
|
| 25 |
+
{%- endif -%}
|
| 26 |
+
{{ '<start_of_turn>' + role + '
|
| 27 |
+
' + (first_user_prefix if loop.first else "") }}
|
| 28 |
+
{%- if message['content'] is string -%}
|
| 29 |
+
{{ message['content'] | trim }}
|
| 30 |
+
{%- elif message['content'] is iterable -%}
|
| 31 |
+
{%- for item in message['content'] -%}
|
| 32 |
+
{%- if item['type'] == 'image' -%}
|
| 33 |
+
{{ '<start_of_image>' }}
|
| 34 |
+
{%- elif item['type'] == 'text' -%}
|
| 35 |
+
{{ item['text'] | trim }}
|
| 36 |
+
{%- endif -%}
|
| 37 |
+
{%- endfor -%}
|
| 38 |
+
{%- else -%}
|
| 39 |
+
{{ raise_exception("Invalid content type") }}
|
| 40 |
+
{%- endif -%}
|
| 41 |
+
{{ '<end_of_turn>
|
| 42 |
+
' }}
|
| 43 |
+
{%- endfor -%}
|
| 44 |
+
{%- if add_generation_prompt -%}
|
| 45 |
+
{{ '<start_of_turn>model
|
| 46 |
+
' }}
|
| 47 |
+
{%- endif -%}
|
Bangla_Text_Summarization/bangla_summarization_adapter/preprocessor_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_convert_rgb": null,
|
| 3 |
+
"do_normalize": true,
|
| 4 |
+
"do_pan_and_scan": null,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Gemma3ImageProcessor",
|
| 13 |
+
"image_seq_length": 256,
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"pan_and_scan_max_num_crops": null,
|
| 20 |
+
"pan_and_scan_min_crop_size": null,
|
| 21 |
+
"pan_and_scan_min_ratio_to_activate": null,
|
| 22 |
+
"processor_class": "Gemma3Processor",
|
| 23 |
+
"resample": 2,
|
| 24 |
+
"rescale_factor": 0.00392156862745098,
|
| 25 |
+
"size": {
|
| 26 |
+
"height": 896,
|
| 27 |
+
"width": 896
|
| 28 |
+
}
|
| 29 |
+
}
|
Bangla_Text_Summarization/bangla_summarization_adapter/processor_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 256,
|
| 3 |
+
"processor_class": "Gemma3Processor"
|
| 4 |
+
}
|
Bangla_Text_Summarization/bangla_summarization_adapter/special_tokens_map.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"boi_token": "<start_of_image>",
|
| 3 |
+
"bos_token": {
|
| 4 |
+
"content": "<bos>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
"eoi_token": "<end_of_image>",
|
| 11 |
+
"eos_token": {
|
| 12 |
+
"content": "<end_of_turn>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false
|
| 17 |
+
},
|
| 18 |
+
"image_token": "<image_soft_token>",
|
| 19 |
+
"pad_token": {
|
| 20 |
+
"content": "<pad>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false
|
| 25 |
+
},
|
| 26 |
+
"unk_token": {
|
| 27 |
+
"content": "<unk>",
|
| 28 |
+
"lstrip": false,
|
| 29 |
+
"normalized": false,
|
| 30 |
+
"rstrip": false,
|
| 31 |
+
"single_word": false
|
| 32 |
+
}
|
| 33 |
+
}
|
Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795
|
| 3 |
+
size 33384568
|
Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
|
| 3 |
+
size 4689074
|
Bangla_Text_Summarization/bangla_summarization_adapter/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Bangla_Text_Summarization/bts_finetune.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Bangla_Text_Summarization/data.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Modelfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM /home/shanin/Desktop/SHANIN/MAIN/ALL_CODE/BTS/Bangla_Text_Summarization/bangla_summarization.Q8_0.gguf
|
| 2 |
+
|
| 3 |
+
PARAMETER num_ctx 2048
|
| 4 |
+
PARAMETER num_batch 512
|
| 5 |
+
PARAMETER num_gpu 1
|
| 6 |
+
|
| 7 |
+
TEMPLATE """<start_of_turn>user
|
| 8 |
+
{{ .Prompt }}<end_of_turn>
|
| 9 |
+
<start_of_turn>model
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
SYSTEM """You are a helpful AI assistant.
|
| 13 |
+
|
| 14 |
+
- If the user asks for a summary (e.g., starts with 'সংক্ষেপ করুন'), respond with a concise Bengali summary.
|
| 15 |
+
- Otherwise, answer general questions naturally in Bengali or English.
|
| 16 |
+
- Keep responses clear, concise, and relevant."""
|
| 17 |
+
|
| 18 |
+
PARAMETER temperature 0.1
|
| 19 |
+
PARAMETER top_k 40
|
| 20 |
+
PARAMETER top_p 0.9
|
| 21 |
+
PARAMETER stop "<end_of_turn>"
|
| 22 |
+
PARAMETER repeat_penalty 1.1
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# ollama create bangla-summarization -f Modelfile
|
| 26 |
+
# ollama rm bangla-summarization
|
main.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request
|
| 2 |
+
import ollama
|
| 3 |
+
|
| 4 |
+
app = Flask(__name__)
|
| 5 |
+
|
| 6 |
+
MODEL_NAME = "bts"
|
| 7 |
+
|
| 8 |
+
@app.route("/")
|
| 9 |
+
def index():
|
| 10 |
+
return render_template("index.html")
|
| 11 |
+
|
| 12 |
+
@app.route("/get", methods=["POST"])
|
| 13 |
+
def chat():
|
| 14 |
+
user_message = request.form["msg"]
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
response = ollama.chat(
|
| 18 |
+
model=MODEL_NAME,
|
| 19 |
+
messages=[{"role": "user", "content": user_message}]
|
| 20 |
+
)
|
| 21 |
+
reply = response['message']['content']
|
| 22 |
+
except Exception as e:
|
| 23 |
+
reply = f"Error: {str(e)}"
|
| 24 |
+
|
| 25 |
+
return reply
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
app.run(host="0.0.0.0", port=5000)
|
static/icon.png
ADDED
|
|
templates/index.html
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Bangla AI Text Summarizer</title>
|
| 7 |
+
<!-- Bootstrap CSS -->
|
| 8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
|
| 9 |
+
<!-- Font Awesome -->
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
+
<!-- Google Fonts: Poppins -->
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
|
| 13 |
+
<!-- Tailwind CSS -->
|
| 14 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 15 |
+
<script>
|
| 16 |
+
tailwind.config = {
|
| 17 |
+
theme: {
|
| 18 |
+
extend: {
|
| 19 |
+
colors: {
|
| 20 |
+
'dark-bg': '#1f2c34',
|
| 21 |
+
'dark-bg-alt': '#1b1b2f',
|
| 22 |
+
'chat-bg': '#222831',
|
| 23 |
+
'header-bg': '#30475e',
|
| 24 |
+
'footer-bg': '#393e46',
|
| 25 |
+
'accent': '#00adb5',
|
| 26 |
+
'accent-hover': '#00b8c4',
|
| 27 |
+
'dark-light': '#393e46',
|
| 28 |
+
'text-light': '#eeeeee',
|
| 29 |
+
},
|
| 30 |
+
},
|
| 31 |
+
},
|
| 32 |
+
};
|
| 33 |
+
</script>
|
| 34 |
+
</head>
|
| 35 |
+
<body class="font-poppins bg-gradient-to-br from-dark-bg to-dark-bg-alt min-h-screen">
|
| 36 |
+
|
| 37 |
+
<div class="chat-container flex justify-center items-center min-h-screen p-5">
|
| 38 |
+
<div class="chat-box w-[550px] max-w-[95%] h-[750px] bg-chat-bg rounded-3xl flex flex-col overflow-hidden shadow-2xl">
|
| 39 |
+
<div class="chat-header flex items-center p-4 bg-header-bg text-white rounded-t-3xl">
|
| 40 |
+
<img src="{{ url_for('static', filename='icon.png') }}" class="chat-avatar w-[55px] h-[55px] mr-3">
|
| 41 |
+
<div>
|
| 42 |
+
<h5 class="mb-0 text-lg font-semibold">Bangla LLM Text Summarizer</h5>
|
| 43 |
+
<small class="text-white/80 text-sm">Powered by Shanin</small>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<div id="chatBody" class="chat-body flex-1 overflow-y-auto p-4">
|
| 48 |
+
<!-- Messages will appear here -->
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<div class="chat-footer p-4 bg-footer-bg rounded-b-3xl">
|
| 52 |
+
<form id="messageForm" class="flex">
|
| 53 |
+
<input type="text" id="text" name="msg" class="form-control flex-1 rounded-full px-4 py-3 bg-chat-bg border border-accent text-text-light placeholder:text-text-light/50 focus:outline-none focus:ring-0 me-2" placeholder="Type a message..." required>
|
| 54 |
+
<button type="submit" class="btn btn-accent rounded-full bg-accent text-white px-5 py-3 hover:bg-accent-hover"><i class="fas fa-paper-plane"></i></button>
|
| 55 |
+
</form>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<!-- jQuery -->
|
| 61 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
| 62 |
+
<!-- Bootstrap JS -->
|
| 63 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.bundle.min.js"></script>
|
| 64 |
+
|
| 65 |
+
<script>
|
| 66 |
+
$(document).ready(function() {
|
| 67 |
+
$("#messageForm").on("submit", function(event) {
|
| 68 |
+
event.preventDefault();
|
| 69 |
+
|
| 70 |
+
const date = new Date();
|
| 71 |
+
const str_time = date.getHours().toString().padStart(2,'0') + ":" + date.getMinutes().toString().padStart(2,'0');
|
| 72 |
+
const rawText = $("#text").val();
|
| 73 |
+
$("#text").val("");
|
| 74 |
+
|
| 75 |
+
// User message
|
| 76 |
+
const userHtml = `
|
| 77 |
+
<div class="message user-message mb-3 flex justify-end">
|
| 78 |
+
<div class="msg-text bg-accent text-white p-3 rounded-3xl max-w-[80%] break-words shadow-md relative">
|
| 79 |
+
${rawText} <span class="time text-[10px] absolute -bottom-4 right-2 text-white/50">${str_time}</span>
|
| 80 |
+
</div>
|
| 81 |
+
</div>`;
|
| 82 |
+
$("#chatBody").append(userHtml).scrollTop($("#chatBody")[0].scrollHeight);
|
| 83 |
+
|
| 84 |
+
// Call Flask API
|
| 85 |
+
$.post("/get", { msg: rawText }, function(data) {
|
| 86 |
+
const botHtml = `
|
| 87 |
+
<div class="message bot-message mb-3 flex justify-start">
|
| 88 |
+
<div class="msg-text bg-dark-light text-text-light p-3 rounded-3xl max-w-[80%] break-words shadow-md relative">
|
| 89 |
+
${data} <span class="time text-[10px] absolute -bottom-4 right-2 text-white/50">${str_time}</span>
|
| 90 |
+
</div>
|
| 91 |
+
</div>`;
|
| 92 |
+
$("#chatBody").append(botHtml).scrollTop($("#chatBody")[0].scrollHeight);
|
| 93 |
+
});
|
| 94 |
+
});
|
| 95 |
+
});
|
| 96 |
+
</script>
|
| 97 |
+
|
| 98 |
+
</body>
|
| 99 |
+
</html>
|