Comments (6)
Hi @alekdev2019
Please refer to the issue #4 .
Thanks!
from sqlova.
Thank you for your quick solution.
I am interesting in changing your code with some different method.
For now, you've been using PyTorch to build the network, but I would like to change it with Tensorflow based.
Would you let me know what is the quick way to achieve this purpose?
Thank you
from sqlova.
Maybe you can start from original BERT code?
Also, as far as I know, most of "natural language → SQL" models are written in pytorch except fews like MAPO (but this is about weak-supervision model) and some baseline code for other SQL training set.
Sorry I can't be of more help on this issue.
Wonseok
from sqlova.
Thank you for your help.
from sqlova.
I have an update on this spec.
I am willing to use Keras, and Keras include a lot of similar module with PyTorch.
I am very concerned how I need to convert a class based code(PyTorch)
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss
class BERTEmbeddings(nn.Module):
def init(self, config):
super(BERTEmbeddings, self).init()
"""Construct the embedding module from word, position and token_type embeddings.
"""
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size)
self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)
# self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load
# any TensorFlow checkpoint file
self.LayerNorm = BERTLayerNorm(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, input_ids, token_type_ids=None):
seq_length = input_ids.size(1)
position_ids = torch.arange(seq_length, dtype=torch.long, device=input_ids.device)
position_ids = position_ids.unsqueeze(0).expand_as(input_ids)
if token_type_ids is None:
token_type_ids = torch.zeros_like(input_ids)
words_embeddings = self.word_embeddings(input_ids)
position_embeddings = self.position_embeddings(position_ids)
token_type_embeddings = self.token_type_embeddings(token_type_ids)
embeddings = words_embeddings + position_embeddings + token_type_embeddings
embeddings = self.LayerNorm(embeddings)
embeddings = self.dropout(embeddings)
return embeddings
As you can see, BERTEmbeddings is a class based on torch.nn.Module, but how I can convert it with keras??
Please help me to implement this.
Thank you
from sqlova.
@whwang299 HI , I am also implementing sqlova in keras with bert embeddings.
I am using pytorch trained bert tokenizer to generate words, positions and segment embeddings .
Were you successful in implementing column attention implementation, as i still struggling with it.
Thanks
Anshu
from sqlova.
Related Issues (20)
- For real industrial application, what strategy to locate the exact table? HOT 1
- How to fine tune sequence-to-SQL?
- How do I use predict.py for custom data? HOT 2
- weird error occurs when run predict.py
- Testing models with predict.py does not give me any results file HOT 1
- Need of results_train.jsonl
- Standford coreNLP
- Training on custom data HOT 4
- Replicating dev results on BERT base
- Training doesn't run + how to predict with custom query? HOT 1
- Keras implementation of Column Attention
- Error with annotate_ws.py HOT 7
- Isuue in utlis.wikisql.py
- TypeError: 'Document' object is not iterable
- There is insufficient memory during training, and the get_wemb_bert function call in the train function applies for a lot of memory
- dbengine HOT 5
- How to use RoBERTa instead of BERT ?
- How can I evaluate the pre-trained model on WikiSQL? HOT 1
- Question about the human eval result, thank you. HOT 2
- No module named 'matplotlib' after I download matplotlib
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlova.