Coder Social home page Coder Social logo

alignment-scripts's People

Contributors

kellymarchisio avatar thomaszen avatar zenglinxiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

alignment-scripts's Issues

*question* How extract alignments from alignment layer ?

Thank you for your great work "Adding Interpretable Attention to Neural Translation Models Improves Word Alignment", In this article, the alignment layer output is a target word, so how to get alignments results? the alignments results is generated by attention weights A?

Training Details about "Alignment Layer" and "Alignment Optimization"

Hi,

I have read your paper "End-to-End Neural Word Alignment Outperforms GIZA++" and "Adding Interpretable Attention to Neural Translation Models Improves Word Alignment". The methods mentioned in your work are very interesting and the experiment results are very good.

Now I am carrying out research in machine translation task, and my work needs good soft alignment results, so I want to implement “alignment layer” and “alignment optimization” to obtain soft alignments for each sentence pair.

Since I can't find the open source code, I need to confirm with you the following questions, or if it is convenient for you to provide open source code?

  1. In appendix A, table 5 shows that Embedding Size is 256 and Hidden Units is 512, is there a linear layer (256*512) here to convert input embedding (256) to hidden states (512)? Or Hidden Units is just a feedforward dimension? so what does Hidden Units mean?
  2. I only know that you used 90k updates for training translation model. What are the configurations of optimizer and lr scheduler when training translation model? Is it the same configuration as the transformer base model?
  3. After training translation model, did you reset the optimizer and lr scheduler to train the alignment layer? Does the optimizer still use Adam the same as the translation model?

*help* something that I want to confirm my understanding is right or not about this article.

background
I have some details need to ask for your help since I am in trouble with reproducing the method (Add+SGD) results in the article "Adding Interpretable Attention to Neural Translation Models Improves Word Alignment".
my anlysis
I have reproduce the method (Rand + SGD) mentioned in this article, so I thought is my errors was caused by forward pass Initialization.
article discription
the article mentioned that: "Therefore, we run a forward pass of the complete Transformer network, extract the attention weights of the alignment layer and start the optimization process with these weights."
my understanding
my understanding is the forward pass model includes the alignment layer and the transformer structure. and I restore all parameters of the forward pass model which has trained.but I got the alignment results is 50% which is lower than your article.

Languages for translation

Hi,

does this code only work on the languages specified? What about other languages like Chinese/Mandarin?

Nonbreaking whitespace corrupts En-Fr and Ro-En vocabulary

FYI, there are non-breaking space characters in some of the Ro-En and En-Fr training files, which causes the nonbreaking whitespace character to be interpreted as a vocabulary word. For instance, we see this in train/roen.lc.plustest.src.vcb:

41390 doliu 10
41391   38
41392 sogor 1

One offending file, for instance, is train/Romanian-English/training/Newspapers/2002.10.02.english.98880.0977.e:

"status seeking    phenomenon in politics"

I fixed this problem by sending the training sentences through sed 's/\xC2\xA0/ /g' (source: https://rmoff.net/2019/01/21/replacing-utf8-non-breaking-space-with-bash/sed-on-the-mac/)
This should perhaps be added to your preprocessing pipeline, since I think the chances of the source published in 2003 being changed are low :)

"help" More details need in Usage Instructions

Hi
Thank you for your work, I follow the usage instructions but I can't using it correctly. because I'm luck the corresponding data set. I have try to understand your code but I found that those dataset has some unfamiliar suffix. Those suffix hinder me to find correct data with data preprocessing.

Thank you for your kindness assistance.

spm BPE part is broken due to the set of --add_dummy_prefix

As the script set spm_train --add_dummy_prefix 1, the resulting subword file begins with '▁'.
This makes the word alignment, which is converted from subword, all start from 1.
The issus do not affect the result of word fastalign, but completely break the fastalign using BPE tokenization.

Here show my result before the fix:

test.deen.bpe.word.grow-diagonal-final.talp: 64.4% (39.8%/32.0%/8127)
test.deen.bpe.word.grow-diagonal.talp: 63.8% (41.7%/31.7%/7647)
test.deen.bpe.word.intersection.talp: 65.7% (41.2%/29.2%/7127)
test.deen.bpe.word.reverse.talp: 65.9% (34.8%/33.4%/9700)
test.deen.bpe.word.talp: 65.7% (34.5%/34.2%/10009)
test.deen.bpe.word.union.talp: 65.9% (30.9%/38.4%/12582)
test.deen.grow-diagonal-final.talp: 27.7% (80.7%/65.5%/7964)
test.deen.grow-diagonal.talp: 27.0% (84.6%/64.1%/7418)
test.deen.intersection.talp: 28.0% (87.1%/61.3%/6863)
test.deen.reverse.talp: 32.0% (69.7%/66.4%/9414)
test.deen.talp: 28.4% (71.3%/71.8%/9932)
test.deen.union.talp: 31.8% (61.4%/77.0%/12483)

Here show my result (bpe part) after the fix (by -1 for all idx in converted talp file):

test.deen.bpe.word.talp.grow-diagonal-final.talp: 25.9% (81.7%/67.6%/8127)
test.deen.bpe.word.talp.grow-diagonal.talp: 25.2% (85.2%/66.5%/7647)
test.deen.bpe.word.talp.intersection.talp: 26.2% (87.3%/63.8%/7127)
test.deen.bpe.word.talp.union.talp: 31.1% (61.8%/78.1%/12582)
test.deen.bpe.word.reverse.talp.new: 30.4% (70.2%/68.9%/9700)

Reference from results/fastalign in the repo:

test.deen.bpe.word.grow-diagonal-final.talp: 27.0% (79.8%/67.2%/8270)
test.deen.bpe.word.grow-diagonal.talp: 26.4% (83.2%/65.9%/7755)
test.deen.bpe.word.intersection.talp: 27.2% (85.9%/63.1%/7171)
test.deen.bpe.word.reverse.talp: 30.9% (68.7%/69.4%/9985)
test.deen.bpe.word.talp: 29.8% (69.4%/71.1%/10099)
test.deen.bpe.word.union.talp: 32.7% (59.7%/77.4%/12913)
test.deen.grow-diagonal-final.talp: 27.7% (80.6%/65.5%/7964)
test.deen.grow-diagonal.talp: 27.0% (84.5%/64.1%/7421)
test.deen.intersection.talp: 28.0% (87.1%/61.3%/6863)
test.deen.reverse.talp: 32.0% (69.7%/66.4%/9421)
test.deen.talp: 28.5% (71.3%/71.8%/9930)
test.deen.union.talp: 31.8% (61.4%/77.0%/12488)

Issues when preprocessing and clarity in instructions?

Am trying to run the alignment-scripts and am experiencing slight issues when running preprocessing. I was confused as to what this instruction meant, if anyone could give an example it might be helpful:

Export install locations for dependencies: export {MOSES_DIR,FASTALIGN_DIR,MGIZA_DIR}=/foo/bar

When running the code I get these issues:

./preprocess/train.sh: line 16: roen.src: No such file or directory
+ ../scripts/lowercase.py
+ for ln_pair in '"roen"' '"enfr"' '"deen"'
+ for suffix in '"src"' '"tgt"'
./preprocess/train.sh: line 16: roen.tgt: No such file or directory
+ ../scripts/lowercase.py
+ for suffix in '"src"' '"tgt"'
+ ../scripts/lowercase.py
+ wait
+ ../scripts/lowercase.py
./preprocess/train.sh: line 16: deen.src: No such file or directory
./preprocess/train.sh: line 16: deen.tgt: No such file or directory
+ cd -
/home/dl1051/alignment-scripts
+ for ln_pair in '"roen"' '"enfr"' '"deen"'
+ for suffix in '"src"' '"tgt"'
+ cat train/roen.lc.src test/roen.lc.src
cat: train/roen.lc.src: No such file or directory

might this have anything to do with the above instruction?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.