Nickitaa commited on
Commit
b209725
1 Parent(s): ca6745d

Upload 7 files

Browse files
model/chatbot direct model apply.ipynb ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 6,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "from transformers import AutoTokenizer, AutoModelForQuestionAnswering\n",
10
+ "import torch\n",
11
+ "\n",
12
+ "model = \"pytorch_model.bin\""
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "tokenizer = AutoTokenizer.from_pretrained(\"model/distilbert-custom\")\n",
22
+ "\n"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "metadata": {},
29
+ "outputs": [],
30
+ "source": [
31
+ "def get_answers(question, context):\n",
32
+ " inputs = tokenizer.encode_plus(question, context, truncation=True, padding=True, return_tensors='pt')\n",
33
+ " input_ids = inputs['input_ids']\n",
34
+ " attention_mask = inputs['attention_mask']\n",
35
+ " \n",
36
+ " with torch.no_grad():\n",
37
+ " output = model(input_ids, attention_mask=attention_mask)\n",
38
+ "\n",
39
+ " answer_start = torch.argmax(output.start_logits)\n",
40
+ " answer_end = torch.argmax(output.end_logits)\n",
41
+ "\n",
42
+ " \n",
43
+ " \n",
44
+ " answer = tokenizer.convert_tokens_to_string(tokenizer.convert_ids_to_tokens(input_ids[0][answer_start:answer_end + 1])) \n",
45
+ " return answer"
46
+ ]
47
+ },
48
+ {
49
+ "cell_type": "code",
50
+ "execution_count": null,
51
+ "metadata": {},
52
+ "outputs": [],
53
+ "source": [
54
+ "context=\"The Foundation of Smart Manufacturing at the Indian Institute of Technology (IIT) is a research and development center dedicated to advancing the field of smart manufacturing in India. IITs are a group of autonomous technical institutions established by the Indian government to promote higher education and research in information technology.The Foundation of Smart Manufacturing focuses on integrating information technology and manufacturing processes to create intelligent and efficient manufacturing systems.Its primary goal is to develop and implement cutting-edge technologies to enhance the productivity, quality, and sustainability of Indian manufacturing industries.During the months of June-July 2021, FSM organized a Summer Online Internship.900+ applications were received and 150+ students were accepted for internships in various domains such as Augmented Reality, Machine Learning, Automation, IIoT, Realtime Dashboards, and Robotics. More than 45 projects were conceptualized and completed during the internship and 20+ Research Papers were prepared by the interns.The FSM Masterclass Series was a 4-month program, having 4 different masterclasses for technologies such as \\u201cAugmented Reality\\u201d,\\u201cMachine Learning\\u201d, \\u201cAutomation\\u201d, and \\u201cIIot\\u201d.The program was attended by college students, college professors and employees from various industries. Each course was a month-long program, consisting of 4 live classes, 4 hands-on lab sessions, e-learning modules and 1 major project.Masterclass Series reviews\"\n",
55
+ "question=\"What is IIT?\"\n",
56
+ "print(f\"Predicted Answer: {get_answers(question, context)}\")"
57
+ ]
58
+ }
59
+ ],
60
+ "metadata": {
61
+ "kernelspec": {
62
+ "display_name": "Python 3",
63
+ "language": "python",
64
+ "name": "python3"
65
+ },
66
+ "language_info": {
67
+ "codemirror_mode": {
68
+ "name": "ipython",
69
+ "version": 3
70
+ },
71
+ "file_extension": ".py",
72
+ "mimetype": "text/x-python",
73
+ "name": "python",
74
+ "nbconvert_exporter": "python",
75
+ "pygments_lexer": "ipython3",
76
+ "version": "3.10.11"
77
+ },
78
+ "orig_nbformat": 4
79
+ },
80
+ "nbformat": 4,
81
+ "nbformat_minor": 2
82
+ }
model/distilbert-custom/config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "model/distilbert-custom",
3
+ "activation": "gelu",
4
+ "architectures": [
5
+ "DistilBertForQuestionAnswering"
6
+ ],
7
+ "attention_dropout": 0.1,
8
+ "dim": 768,
9
+ "dropout": 0.1,
10
+ "eos_token_ids": null,
11
+ "hidden_dim": 3072,
12
+ "initializer_range": 0.02,
13
+ "max_position_embeddings": 512,
14
+ "model_type": "distilbert",
15
+ "n_heads": 12,
16
+ "n_layers": 6,
17
+ "output_past": true,
18
+ "pad_token_id": 0,
19
+ "qa_dropout": 0.1,
20
+ "seq_classif_dropout": 0.2,
21
+ "sinusoidal_pos_embds": false,
22
+ "tie_weights_": true,
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.30.2",
25
+ "vocab_size": 30522
26
+ }
model/distilbert-custom/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07ff1b728f265dcaa6e9d5ca5a57d9301168bacf070ec505044f294cb7f12cd8
3
+ size 265491109
model/distilbert-custom/special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
model/distilbert-custom/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
model/distilbert-custom/tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "clean_up_tokenization_spaces": true,
3
+ "cls_token": "[CLS]",
4
+ "do_basic_tokenize": true,
5
+ "do_lower_case": true,
6
+ "mask_token": "[MASK]",
7
+ "max_len": 512,
8
+ "model_max_length": 512,
9
+ "never_split": null,
10
+ "pad_token": "[PAD]",
11
+ "sep_token": "[SEP]",
12
+ "strip_accents": null,
13
+ "tokenize_chinese_chars": true,
14
+ "tokenizer_class": "DistilBertTokenizer",
15
+ "unk_token": "[UNK]"
16
+ }
model/distilbert-custom/vocab.txt ADDED
The diff for this file is too large to render. See raw diff