some edit on kw readme
This commit is contained in:
parent
61c50ae476
commit
3bdaddcd61
|
@ -15,7 +15,8 @@ model = "./models/ner/2025-07-22--20-44-37--HooshvareLab--bert-fa-base-uncased-n
|
||||||
tagger = SequenceTagger.load(model)
|
tagger = SequenceTagger.load(model)
|
||||||
print('model read and tagger initialized')
|
print('model read and tagger initialized')
|
||||||
|
|
||||||
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
|
date = datetime.datetime.now()
|
||||||
|
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
|
||||||
|
|
||||||
def prepare_data(ner_obj_list):
|
def prepare_data(ner_obj_list):
|
||||||
ner_data_list = []
|
ner_data_list = []
|
||||||
|
|
|
@ -15,7 +15,8 @@ os.environ['HF_HOME'] = "/home/admin/HFHOME"
|
||||||
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
||||||
#model_id = "meta-llama/Llama-3.1-70B-Instruct"
|
#model_id = "meta-llama/Llama-3.1-70B-Instruct"
|
||||||
|
|
||||||
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
|
date = datetime.datetime.now()
|
||||||
|
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
|
||||||
|
|
||||||
bnb_config = BitsAndBytesConfig(
|
bnb_config = BitsAndBytesConfig(
|
||||||
load_in_8bit=True, bnb_8bit_use_double_quant=True, bnb_8bit_quant_type="nf8", bnb_8bit_compute_dtype=torch.bfloat16
|
load_in_8bit=True, bnb_8bit_use_double_quant=True, bnb_8bit_quant_type="nf8", bnb_8bit_compute_dtype=torch.bfloat16
|
||||||
|
|
|
@ -6,7 +6,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
import torch
|
import torch
|
||||||
import json
|
import json
|
||||||
|
|
||||||
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
|
date = datetime.datetime.now()
|
||||||
|
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
|
||||||
|
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# Keyword Extractor
|
# Keyword Extractor
|
||||||
|
|
||||||
This project is a simple script for extracting keywords from text using Natural Language Processing (NLP).
|
This source is a script for extracting keywords from text using local LLM such as llama based on user prompts.
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
The script processes input text and extracts the most relevant keywords using a **pre-trained transformer model** (e.g., `bert-base-uncased` or a similar NLP model).
|
The script processes input text and extracts the most relevant keywords using a large language model(llm) and system and user prompts which are embedded in the source code.
|
||||||
It is designed to be lightweight, easy to run, and customizable.
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- Python 3.8+
|
- Python 3.8+
|
||||||
|
@ -31,8 +30,5 @@ For exact versions of the libraries, please check the **`requirements.txt`** fil
|
||||||
- `display_results(keywords)`: Prints or saves the extracted keywords for further use.
|
- `display_results(keywords)`: Prints or saves the extracted keywords for further use.
|
||||||
|
|
||||||
## Model
|
## Model
|
||||||
The script uses a **transformer-based model** for keyword extraction. The exact model can be changed in the code if needed.
|
The script uses a LLM such as llama3.1-8B for keyword extraction. The exact model can be changed in the code if needed.
|
||||||
|
|
||||||
## Notes
|
|
||||||
- Works with English (and potentially other languages, depending on the model).
|
|
||||||
- Results may vary based on the model and input text.
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# استخراجگر کلمات کلیدی
|
# استخراجگر کلمات کلیدی
|
||||||
|
|
||||||
این پروژه یک اسکریپت ساده برای استخراج کلمات کلیدی از متن با استفاده از **پردازش زبان طبیعی (NLP)** است.
|
این سورس، یک اسکریپت برای استخراج کلمات کلیدی از متن با استفاده از مدل های زبانی بزرگی مانند لاما و بر اساس پرامپت های کاربر است.
|
||||||
|
|
||||||
## نحوه عملکرد
|
## نحوه عملکرد
|
||||||
این اسکریپت متن ورودی را پردازش کرده و مرتبطترین کلمات کلیدی را با استفاده از یک **مدل از پیش آموزشدیده (Transformer Model)** (مانند `bert-base-uncased` یا مدل مشابه) استخراج میکند.
|
این اسکریپت متن ورودی را پردازش کرده و مرتبطترین کلمات کلیدی را با استفاده از یک مدل زبانی بزرگ با پرامپت های سیستمی و کاربری که در سورس قابل مشاهده است، استخراج می کند
|
||||||
طراحی آن ساده، سبک و قابل تغییر است.
|
|
||||||
|
|
||||||
## پیشنیازها
|
## پیشنیازها
|
||||||
- پایتون 3.8 یا بالاتر
|
- پایتون 3.8 یا بالاتر
|
||||||
|
@ -31,8 +30,5 @@
|
||||||
- `display_results(keywords)`: نمایش یا ذخیرهسازی کلمات کلیدی استخراجشده برای استفادههای بعدی.
|
- `display_results(keywords)`: نمایش یا ذخیرهسازی کلمات کلیدی استخراجشده برای استفادههای بعدی.
|
||||||
|
|
||||||
## مدل
|
## مدل
|
||||||
این اسکریپت از یک **مدل مبتنی بر Transformer** برای استخراج کلمات کلیدی استفاده میکند. در صورت نیاز میتوانید مدل را در کد تغییر دهید.
|
این اسکریپت از یک مدل زبانی بزرگ مانند llama3.1-8B برای استخراج کلمات کلیدی استفاده میکند. در صورت نیاز میتوانید مدل را در کد تغییر دهید.
|
||||||
|
|
||||||
## نکات
|
|
||||||
- با زبان انگلیسی (و در صورت پشتیبانی مدل، سایر زبانها) کار میکند.
|
|
||||||
- کیفیت نتایج به مدل و متن ورودی وابسته است.
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user