Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mayang1202 committed Sep 25, 2023
0 parents commit b542f86
Show file tree
Hide file tree
Showing 141 changed files with 30,090 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app/ai_model/teacher_behavior_detection/data/roberta_wwm_ext_large/pytorch_model.bin
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# teacher_behavior_detection

Empty file added app/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions app/ai_model/detect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#coding:utf-8
import os
import threading
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import sys
base_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(base_path,'./teacher_behavior_detection'))
sys.path.append(os.path.join(base_path,'./teacher_behavior_detection/src/auto_text_classifier'))
from src.teacher_behavior_detection import detect as model_detect

m_locker = threading.Lock()

def detect(*args,**kvargs):
with m_locker:
return model_detect(*args,**kvargs)

46 changes: 46 additions & 0 deletions app/ai_model/teacher_behavior_detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# TeacherBehaviorDetector
输入ASR文本,判断每句话是否为某种教学行为(鼓励、举例、提醒笔记、引导、复述、复习、寒暄、总结)。


## 安装

1、安装虚拟环境
```sh
conda create --name=4s_dev python=3.7.5
source activate behavior_dev
```

>确保当前环境是`behavior_dev`
2、安装依赖

第一步:
`conda install tensorflow-gpu==1.13.1 cudatoolkit=10.0.130=0`

第二步:

`pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html`

然后

`pip install -r requirements_gpu.txt`

3、为jupyter安装core(可选)

`ipython kernel install --user --name=behavior_dev`

这时你发现jupyter 多了一个叫`behavior_dev`的core。

删除核心

`jupyter kernelspec remove behavior_dev`


# 算法指标

参考算法文档:
https://wiki.zhiyinlou.com/pages/viewpage.action?pageId=99908958

# Usage

参考demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"bos_token_id": 0,
"directionality": "bidi",
"eos_token_id": 2,
"eos_token_ids": null,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1",
"2": "LABEL_2",
"3": "LABEL_3",
"4": "LABEL_4",
"5": "LABEL_5",
"6": "LABEL_6",
"7": "LABEL_7",
"8": "LABEL_8"
},
"initializer_range": 0.02,
"intermediate_size": 3072,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1,
"LABEL_2": 2,
"LABEL_3": 3,
"LABEL_4": 4,
"LABEL_5": 5,
"LABEL_6": 6,
"LABEL_7": 7,
"LABEL_8": 8
},
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"output_hidden_states": true,
"output_past": true,
"pad_token_id": 1,
"pooler_fc_size": 768,
"pooler_num_attention_heads": 12,
"pooler_num_fc_layers": 3,
"pooler_size_per_head": 128,
"pooler_type": "first_token_transform",
"type_vocab_size": 2,
"vocab_size": 21128
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"unk_token": "[UNK]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "sep_token": "[SEP]"}
Loading

0 comments on commit b542f86

Please sign in to comment.