Zeliang-Codetech commited on
Commit
4e2a2dc
·
0 Parent(s):

Initial commit

Browse files
.gitattributes ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ *.bin filter=lfs diff=lfs merge=lfs -text
2
+ *.pt filter=lfs diff=lfs merge=lfs -text
3
+ *.pth filter=lfs diff=lfs merge=lfs -text
4
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .venv
2
+ __pycache__
bitch.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Company_Name,Location,Founder,Industry,Core_Focus,Mission,Vision,Team,Key_Offerings,Notable_Projects,Technology_Used,Project_Impacts,Community_Engagement
2
+ Zeliang Codetech Private Limited,"Nagaland, India",Kangzang Zeliang,"IT, IoT, Software Development","Innovative technology solutions bridging hardware, software, and IoT",To address challenges within local communities and industries by integrating accessible technology solutions,"To empower businesses and civic organizations with smart solutions, improving operational efficiency and promoting technology-driven convenience","Composed of young, talented developers from the Naga community, committed to tech development",- IoT Solutions: Intelligent hardware-software integrations for smart applications,Smart Garbage Disposal Management System (SGDMS 1.0V): IoT-enabled waste management system with real-time tracking and notifications when bins are full,"IoT sensors, real-time data tracking, custom POS software, machine learning algorithms, data analytics, dashboards, and mobile app notifications","- SGDMS 1.0V: Improves public sanitation, reduces collection costs, and enhances environmental impact","Prioritizes local talent and supports the technical growth of its team, working closely with community organizations and fostering innovation in Northeast India"
3
+ ,,,,,,,,- Software Development: Full-stack services for web and mobile apps,Retail POS Systems: Custom POS solutions for small and medium businesses,,- POS Systems: Streamlines business operations and enhances efficiency,
4
+ ,,,,,,,,- POS Systems: Custom solutions for business needs,AI-Driven Predictive Analytics: ML-driven insights into customer trends and operational data,,- Predictive Analytics: Empowers businesses with data-driven insights,
5
+ ,,,,,,,,- AI & Machine Learning Applications: Predictive and data-driven solutions
cached_lm_GPT2Tokenizer_128_train_data.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ �]�.
csvs/company_name.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Company_Name
2
+ Zeliang codetech
3
+ Zeliangcodetech
4
+ zeliangcodetech
5
+ zeliangCodetech
6
+ zeliang-codetech
7
+ zeliang codetech
8
+ zeliang_code_tech
9
+ zeliang-code-tech
10
+ ZELIANG CODETECH
11
+ ZELIANG-CODETECH
12
+ ZELIANG-CODE-TECH
13
+ ZeLiAnGCoDeTeCh
csvs/founder.csv ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Founder
2
+ Kangzang Zeliang
3
+ KangzangZeliang
4
+ kangzang_zeliang
5
+ kangzang-zeliang
6
+ kangzang-zeliang
7
+ kangzang-zeliang
8
+ KangzangZeliang
9
+ Kangzang Zeliang
10
+ kAnGzAnG zElIaNg
11
+ Kangzang
12
+ Zeliang
csvs/industry.csv ADDED
@@ -0,0 +1 @@
 
 
1
+ Industry
csvs/location.csv ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Location
2
+ DimapurNagalandIndia
3
+ dimapur_nagaland_india
4
+ dimapur-nagaland-india
5
+ DIMAPUR NAGALAND INDIA
6
+ dimapur nagaland india
7
+ DimapurNagalandIndia
8
+ Dimapur Nagaland India
9
+ dImApUr nAgAlAnD iNdIa
10
+ Dimapur nagaland india
11
+ Dimapur.Nagaland.India
12
+ dImApUr_nAgAlAnD-iNdIa
13
+ D1m4pUr N4g4l4nd 1nd14
14
+ Diiimmaapuurr Nagggaallandd Iinddiiiaa
15
+ im Nag Ind
16
+ DIMAPUR NAGALAND INDIA
17
+ Dimapur
18
+ Nagaland
19
+ India
20
+ Naga
21
+ Nagaland
22
+ Bank colony Supermarket
23
+ BankColonySupermarket
24
+ bank_colony_supermarket
25
+ bank-colony-supermarket
26
+ BANK COLONY SUPERMARKET
27
+ BANK COLONY SUPERMARKET
28
+ BankColonySupermarket
29
+ Bank Colony Supermarket
30
+ bAnK cOlOnY sUpErMaRkEt
31
+ Bank colony Dimapur
32
+ Super market Dimapur
33
+ Bank colony
34
+ Supermarket
35
+ Ind
36
+ NL
csvs/mission.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Mission
2
+ We believe in the power of the internet and Internet of Things to transform our lives in a positive way We believe that the future is now With the wide-spread application of artificial learning and machine learning it's more so.
3
+ We live a life filled with technological marvels that aid us ubiquitously
gpt2-custom/checkpoint-35/config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "gpt2",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "reorder_and_upcast_attn": false,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_by_inverse_layer_idx": false,
23
+ "scale_attn_weights": true,
24
+ "summary_activation": null,
25
+ "summary_first_dropout": 0.1,
26
+ "summary_proj_to_labels": true,
27
+ "summary_type": "cls_index",
28
+ "summary_use_proj": true,
29
+ "task_specific_params": {
30
+ "text-generation": {
31
+ "do_sample": true,
32
+ "max_length": 50
33
+ }
34
+ },
35
+ "torch_dtype": "float32",
36
+ "transformers_version": "4.46.0",
37
+ "use_cache": true,
38
+ "vocab_size": 50257
39
+ }
gpt2-custom/checkpoint-35/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.46.0"
6
+ }
gpt2-custom/checkpoint-35/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fda0a5151c125b62530ce0a3bdc0c7ac15a31787ff084cc3a4bd87eb840a7cd5
3
+ size 497774208
gpt2-custom/checkpoint-35/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbcc017831e14300ef4b71c319fc917bc3900c105e5e8b831eb8de574b4dd554
3
+ size 995638202
gpt2-custom/checkpoint-35/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c98859a12d53c0b788e8d709c65c4d35bac9cee26017cc95fb42c6c969931e04
3
+ size 13990
gpt2-custom/checkpoint-35/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d878f9de4609bd4fbbedb6ef1d1b6a282880aef389509b2fedeceab92b946e8
3
+ size 1064
gpt2-custom/checkpoint-35/trainer_state.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 5.0,
5
+ "eval_steps": 500,
6
+ "global_step": 35,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [],
11
+ "logging_steps": 500,
12
+ "max_steps": 35,
13
+ "num_input_tokens_seen": 0,
14
+ "num_train_epochs": 5,
15
+ "save_steps": 10000,
16
+ "stateful_callbacks": {
17
+ "TrainerControl": {
18
+ "args": {
19
+ "should_epoch_stop": false,
20
+ "should_evaluate": false,
21
+ "should_log": false,
22
+ "should_save": true,
23
+ "should_training_stop": true
24
+ },
25
+ "attributes": {}
26
+ }
27
+ },
28
+ "total_flos": 6532300800000.0,
29
+ "train_batch_size": 3,
30
+ "trial_name": null,
31
+ "trial_params": null
32
+ }
gpt2-custom/checkpoint-35/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86e69812d76976eae1f510debcec68b20eed3acc4e6acd97c07e1f97ec59d2ab
3
+ size 5176
gpt2-custom/checkpoint-60/config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "gpt2",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "reorder_and_upcast_attn": false,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_by_inverse_layer_idx": false,
23
+ "scale_attn_weights": true,
24
+ "summary_activation": null,
25
+ "summary_first_dropout": 0.1,
26
+ "summary_proj_to_labels": true,
27
+ "summary_type": "cls_index",
28
+ "summary_use_proj": true,
29
+ "task_specific_params": {
30
+ "text-generation": {
31
+ "do_sample": true,
32
+ "max_length": 50
33
+ }
34
+ },
35
+ "torch_dtype": "float32",
36
+ "transformers_version": "4.46.0",
37
+ "use_cache": true,
38
+ "vocab_size": 50257
39
+ }
gpt2-custom/checkpoint-60/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.46.0"
6
+ }
gpt2-custom/checkpoint-60/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71d38e7bf6feb3aadca56675812363fde64a32e3033adc9791c40a58c415d3fa
3
+ size 497774208
gpt2-custom/checkpoint-60/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d6618ece00a33e1bcb48c75ab9c7081362a6a675f9870c6aa7c602c249b91c9
3
+ size 995638202
gpt2-custom/checkpoint-60/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc44dde0c9d8726cdf4a901b295b7d49dd152982941d5d7b7aaf9e60f7d0cf4f
3
+ size 13990
gpt2-custom/checkpoint-60/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90979e82e94259c1d6f68c5ef23bb17c7019c0bbe3422cf6d46e9cdac106c874
3
+ size 1064
gpt2-custom/checkpoint-60/trainer_state.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 5.0,
5
+ "eval_steps": 500,
6
+ "global_step": 60,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [],
11
+ "logging_steps": 500,
12
+ "max_steps": 60,
13
+ "num_input_tokens_seen": 0,
14
+ "num_train_epochs": 5,
15
+ "save_steps": 10000,
16
+ "stateful_callbacks": {
17
+ "TrainerControl": {
18
+ "args": {
19
+ "should_epoch_stop": false,
20
+ "should_evaluate": false,
21
+ "should_log": false,
22
+ "should_save": true,
23
+ "should_training_stop": true
24
+ },
25
+ "attributes": {}
26
+ }
27
+ },
28
+ "total_flos": 11431526400000.0,
29
+ "train_batch_size": 3,
30
+ "trial_name": null,
31
+ "trial_params": null
32
+ }
gpt2-custom/checkpoint-60/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86e69812d76976eae1f510debcec68b20eed3acc4e6acd97c07e1f97ec59d2ab
3
+ size 5176
gpt2-custom/config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "gpt2",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "reorder_and_upcast_attn": false,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_by_inverse_layer_idx": false,
23
+ "scale_attn_weights": true,
24
+ "summary_activation": null,
25
+ "summary_first_dropout": 0.1,
26
+ "summary_proj_to_labels": true,
27
+ "summary_type": "cls_index",
28
+ "summary_use_proj": true,
29
+ "task_specific_params": {
30
+ "text-generation": {
31
+ "do_sample": true,
32
+ "max_length": 50
33
+ }
34
+ },
35
+ "torch_dtype": "float32",
36
+ "transformers_version": "4.46.0",
37
+ "use_cache": true,
38
+ "vocab_size": 50257
39
+ }
gpt2-custom/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.46.0"
6
+ }
gpt2-custom/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
gpt2-custom/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0cb1da30d2283f048311505fd22ce8ab96bed0f416a17593dee04505fbca16e
3
+ size 497774208
gpt2-custom/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|endoftext|>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<|endoftext|>",
17
+ "unk_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
gpt2-custom/tokenizer_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "50256": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ }
13
+ },
14
+ "bos_token": "<|endoftext|>",
15
+ "clean_up_tokenization_spaces": false,
16
+ "eos_token": "<|endoftext|>",
17
+ "errors": "replace",
18
+ "model_max_length": 1024,
19
+ "pad_token": "<|endoftext|>",
20
+ "tokenizer_class": "GPT2Tokenizer",
21
+ "unk_token": "<|endoftext|>"
22
+ }
gpt2-custom/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
main.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
2
+ import torch
3
+
4
+ def setup_gpt2():
5
+ # Load the model and tokenizer
6
+ tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
7
+ model = GPT2LMHeadModel.from_pretrained('gpt2')
8
+
9
+ # Add padding token to tokenizer
10
+ if tokenizer.pad_token is None:
11
+ tokenizer.pad_token = tokenizer.eos_token
12
+ model.config.pad_token_id = model.config.eos_token_id
13
+
14
+ return model, tokenizer
15
+
16
+ def generate_text(prompt, model, tokenizer):
17
+ # Convert prompt to tokens and create attention mask
18
+ inputs = tokenizer(
19
+ prompt,
20
+ return_tensors='pt',
21
+ padding=True,
22
+ truncation=True,
23
+ max_length=512 # Set appropriate max length for your use case
24
+ )
25
+
26
+ # Generate text with attention mask
27
+ outputs = model.generate(
28
+ input_ids=inputs['input_ids'],
29
+ attention_mask=inputs['attention_mask'],
30
+ max_length=100,
31
+ num_return_sequences=1,
32
+ no_repeat_ngram_size=2,
33
+ pad_token_id=tokenizer.pad_token_id,
34
+ )
35
+
36
+ # Convert back to text
37
+ generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
38
+ return generated_text
39
+
40
+ # How to use it:
41
+ model, tokenizer = setup_gpt2()
42
+ prompt = "what is earth"
43
+ result = generate_text(prompt, model, tokenizer)
44
+ print(result)
testModel ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 2ac6c923ec697de160050ddea146973ee1536128
train.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer, DataCollatorForLanguageModeling
3
+ from transformers import Trainer, TrainingArguments
4
+ from datasets import load_dataset
5
+ import pandas as pd
6
+ import os
7
+
8
+ def check_device():
9
+ """Check and return the available device"""
10
+ if torch.cuda.is_available():
11
+ print("Using GPU:", torch.cuda.get_device_name(0))
12
+ return "cuda"
13
+ else:
14
+ print("No GPU available, using CPU")
15
+ return "cpu"
16
+
17
+ def prepare_data(csv_file, text_column):
18
+ """Prepare training data, filtering out empty rows."""
19
+ df = pd.read_csv(csv_file)
20
+
21
+ # Filter out rows where the specified column is NaN
22
+ df = df.dropna(subset=[text_column])
23
+
24
+ # Save texts to a file
25
+ with open('train_data.txt', 'w', encoding='utf-8') as f:
26
+ for text in df[text_column]:
27
+ f.write(str(text) + '\n')
28
+
29
+ return 'train_data.txt'
30
+
31
+ def tokenize_function(examples, tokenizer):
32
+ """Tokenize the text using the GPT-2 tokenizer"""
33
+ # Turn each sentence into codes (tokens) the robot can understand
34
+ return tokenizer(examples['text'], padding="max_length", truncation=True, max_length=128)
35
+
36
+ def train_model(model, dataset, tokenizer):
37
+ """Train the model with proper device configuration"""
38
+ # Set up data collator
39
+ data_collator = DataCollatorForLanguageModeling(
40
+ tokenizer=tokenizer,
41
+ mlm=False
42
+ )
43
+
44
+ # Create output directory if it doesn't exist
45
+ os.makedirs("./gpt2-custom", exist_ok=True)
46
+
47
+ # Set up training arguments with device-aware settings
48
+ training_args = TrainingArguments(
49
+ output_dir="./gpt2-custom",
50
+ overwrite_output_dir=True,
51
+ num_train_epochs=5,
52
+ per_device_train_batch_size=3, # Reduced batch size for CPU
53
+ per_device_eval_batch_size=3, # Reduced batch size for CPU
54
+ save_steps=10_000,
55
+ save_total_limit=2,
56
+ logging_dir="./logs",
57
+ logging_steps=500,
58
+ use_cpu=(check_device() == "cpu"), # Disable CUDA if no GPU
59
+ )
60
+
61
+ # Tokenize the dataset
62
+ dataset = dataset.map(lambda examples: tokenize_function(examples, tokenizer), batched=True)
63
+ dataset.set_format(type="torch", columns=["input_ids", "attention_mask"])
64
+
65
+ # Initialize trainer with tokenized dataset
66
+ trainer = Trainer(
67
+ model=model,
68
+ args=training_args,
69
+ data_collator=data_collator,
70
+ train_dataset=dataset['train'],
71
+ )
72
+
73
+ # Train the model
74
+ trainer.train()
75
+
76
+ # Save the model
77
+ model.save_pretrained('./gpt2-custom')
78
+ tokenizer.save_pretrained('./gpt2-custom')
79
+
80
+ def main():
81
+ try:
82
+ # Check device first
83
+ device = check_device()
84
+
85
+ # Example usage
86
+ csv_file = './csvs/mission.csv' # Replace with your CSV file path
87
+ text_column = 'Mission' # Replace with your text column name
88
+
89
+ # Prepare data
90
+ print("Preparing data...")
91
+ train_file = prepare_data(csv_file, text_column)
92
+
93
+ # Load model and tokenizer
94
+ print("Loading model and tokenizer...")
95
+ tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
96
+ model = GPT2LMHeadModel.from_pretrained('gpt2')
97
+
98
+ # Move model to appropriate device
99
+ model = model.to(device)
100
+
101
+ # Add padding token
102
+ tokenizer.pad_token = tokenizer.eos_token
103
+
104
+ # Load dataset with `datasets` library
105
+ print("Loading dataset...")
106
+ dataset = load_dataset('text', data_files={'train': train_file})
107
+
108
+ # Train model
109
+ print("Training model...")
110
+ train_model(model, dataset, tokenizer)
111
+
112
+ print("Training completed successfully!")
113
+
114
+ except Exception as e:
115
+ print(f"An error occurred: {str(e)}")
116
+ print("Stack trace:")
117
+ import traceback
118
+ traceback.print_exc()
119
+
120
+ if __name__ == "__main__":
121
+ main()
train_data.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ We believe in the power of the internet and Internet of Things to transform our lives in a positive way We believe that the future is now With the wide-spread application of artificial learning and machine learning it's more so.
2
+ We live a life filled with technological marvels that aid us ubiquitously
zeliang_codetech_structured_details.csv ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Category,Details
2
+ Company_Name,Zeliang Codetech Private Limited
3
+ Location,"Nagaland, India"
4
+ Founder,Kangzang Zeliang
5
+ Industry," IT IoT Software Development SAAS"
6
+ Core_Focus,"Innovative technology solutions bridging hardware, software, and IoT"
7
+ Mission,To address challenges within local communities and industries by integrating accessible technology solutions
8
+ Vision,"To empower businesses and civic organizations with smart solutions, improving operational efficiency and promoting technology-driven convenience"
9
+ Team,"Composed of young, talented developers from the Naga community, committed to tech development"
10
+ Key_Offerings,"- IoT Solutions: Intelligent hardware-software integrations for smart applications
11
+ - Software Development: Full-stack services for web and mobile apps
12
+ - POS Systems: Custom solutions for business needs
13
+ - AI & Machine Learning Applications: Predictive and data-driven solutions"
14
+ Notable_Projects,"Smart Garbage Disposal Management System (SGDMS 1.0V): IoT-enabled waste management system with real-time tracking and notifications when bins are full
15
+ Retail_POS_Systems: Custom POS solutions for small and medium businesses
16
+ AI-Driven_Predictive Analytics: ML-driven insights into customer trends and operational data"
17
+ Technology_Used,"IoT sensors, real-time data tracking, custom POS software, machine learning algorithms, data analytics, dashboards, and mobile app notifications"
18
+ Project_Impacts,"SGDMS 1.0V: Improves public sanitation, reduces collection costs, and enhances environmental impact
19
+ POS_Systems: Streamlines business operations and enhances efficiency
20
+ Predictive_Analytics: Empowers businesses with data-driven insights"
21
+ Community_Engagement,"Prioritizes local talent and supports the technical growth of its team, working closely with community organizations and fostering innovation in Northeast India"