Browse Source

修改注释bug

liuyuqi-dellpc 6 years ago
parent
commit
c5a727a42b
11 changed files with 73 additions and 21 deletions
  1. 13 0
      .dockerignore
  2. 1 0
      .gitignore
  3. 10 0
      Dockerfile
  4. 10 0
      docker-compose.debug.yml
  5. 6 0
      docker-compose.yml
  6. 3 0
      pip.conf
  7. 0 18
      preview.py
  8. 13 0
      sqlnet/model/modules/aggregator_predict.py
  9. 4 1
      sqlnet/model/sqlnet.py
  10. 2 2
      sqlnet/utils.py
  11. 11 0
      test.py

+ 13 - 0
.dockerignore

@@ -0,0 +1,13 @@
+node_modules
+npm-debug.log
+Dockerfile*
+docker-compose*
+.dockerignore
+.git
+.gitignore
+.env
+*/bin
+*/obj
+README.md
+LICENSE
+.vscode

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 /data
 *.pyc
+/.idea

+ 10 - 0
Dockerfile

@@ -0,0 +1,10 @@
+FROM python:alpine
+LABEL Name=nl2sql_baseline Version=1.0.1
+
+WORKDIR /app
+RUN mkdir -p ~/.pip
+ADD pip.conf /root/.pip
+ADD requirements.txt /app
+RUN python3 -m pip install -r requirements.txt
+ADD . /app
+CMD /bin/bash -c "sh ./start_train.sh 0 128"

+ 10 - 0
docker-compose.debug.yml

@@ -0,0 +1,10 @@
+version: '2.1'
+
+services:
+  nl2sql_baseline:
+    image: nl2sql_baseline
+    build:
+      context: .
+      dockerfile: Dockerfile
+    ports:
+      - 3000:3000

+ 6 - 0
docker-compose.yml

@@ -0,0 +1,6 @@
+version: '2.1'
+
+services:
+  nl2sql_baseline:
+    image: nl2sql_baseline:1.0.1
+    build: .

+ 3 - 0
pip.conf

@@ -0,0 +1,3 @@
+[global]
+    trusted-host=mirrors.aliyun.com
+    index-url=http://mirrors.aliyun.com/pypi/simple/

+ 0 - 18
preview.py

@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@File    :   preview.py
-@Time    :   2019/06/25 11:24:20
-@Author  :   Liuyuqi 
-@Version :   1.0
-@Contact :   liuyuqi.gov@msn.cn
-@License :   (C)Copyright 2019
-@Desc    :   数据预览
-'''
-from sqlnet.utils import *
-from sqlnet.model.sqlnet import SQLNet
-
-if __name__ == "__main__":
-    train_sql, train_table, train_db, dev_sql, dev_table, dev_db = load_dataset(
-            use_small=True)
-    print(train_sql)

+ 13 - 0
sqlnet/model/modules/aggregator_predict.py

@@ -1,3 +1,16 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@File    :   aggregator_predict.py
+@Time    :   2019/07/07 23:42:10
+@Author  :   Liuyuqi 
+@Version :   1.0
+@Contact :   liuyuqi.gov@msn.cn
+@License :   (C)Copyright 2019
+@Desc    :   None
+'''
+
+
 import json
 import torch
 import torch.nn as nn

+ 4 - 1
sqlnet/model/sqlnet.py

@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+
 import torch
 import torch.nn as nn
 import torch.nn.functional as F
@@ -10,7 +13,7 @@ from sqlnet.model.modules.sqlnet_condition_predict import SQLNetCondPredictor
 from sqlnet.model.modules.select_number import SelNumPredictor
 from sqlnet.model.modules.where_relation import WhereRelationPredictor
 
-# 定义SQLNet模型
+# 定义 SQLNet 模型
 class SQLNet(nn.Module):
     def __init__(self, word_emb, N_word, N_h=100, N_depth=2,
             gpu=False, use_ca=True, trainable_emb=False):

+ 2 - 2
sqlnet/utils.py

@@ -121,12 +121,12 @@ def to_batch_query(sql_data, idxes, st, ed):
     return query_gt, table_ids
 
 def epoch_train(model, optimizer, batch_size, sql_data, table_data):
-    ‘’‘
+    '''
     训练
     model,optimizer
     batch_size=16
 
-    ’‘’
+    '''
     model.train()
     perm=np.random.permutation(len(sql_data))
     perm = list(range(len(sql_data)))

+ 11 - 0
test.py

@@ -1,3 +1,14 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@File    :   test.py
+@Time    :   2019/07/07 23:41:48
+@Author  :   Liuyuqi 
+@Version :   1.0
+@Contact :   liuyuqi.gov@msn.cn
+@License :   (C)Copyright 2019
+@Desc    :   测试代码
+'''
 import torch
 from sqlnet.utils import *
 from sqlnet.model.sqlnet import SQLNet