Giter Site home page Giter Site logo

Comments (9)

shamilcm avatar shamilcm commented on August 19, 2024 1

I see you have a conda/virtualenv enabled. I am suspecting you are switching to Python3 for running rerank.sh. Can you verify if python2.7 is being used?

from mlconvgec2018.

young-zonglin avatar young-zonglin commented on August 19, 2024 1

Yes, it is the problem!! I found that some python scripts in nusnlp/nbest-reranker project use python interpreter specified by #!/usr/bin/env python instead of #!/usr/bin/python. In my Ubuntu, #!/usr/bin/python means python 2.7, however #!/usr/bin/env python means python 3.6

from mlconvgec2018.

shamilcm avatar shamilcm commented on August 19, 2024

The first error is something which I never encountered. I suspect it has got to do with the language you are dealing with. Are you using English outputs or any other language? I have only tested the nbest reranker on English. Can you send your nbest list (before and after augmentation)? It is weird that augmentation step on the nbest list seems to have no issues but reranker causes a problem. Did you try training the weights of the reranker successfully?

Regarding Levenshtein distance, the M2 implementation in Moses skips sentence pairs that are too different in terms of length due to efficiency reasons during training.

from mlconvgec2018.

young-zonglin avatar young-zonglin commented on August 19, 2024

Hi, thank you for your reply firstly. Actually I am using rescoring mechanism in Chinese GEC task. The nbest list before augmentation(${output_dir}/output.tok.nbest.reformat.txt) is as follows:

0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.04735666885972023 ||| -0.04735666885972023
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味道 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.06592220067977905 ||| -0.06592220067977905
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.1047820895910263 ||| -0.1047820895910263
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 , 不 复杂 。 ||| F0= -0.1169404685497284 ||| -0.1169404685497284
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 口味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.12856733798980713 ||| -0.12856733798980713
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味道 确实 让 人 上瘾 , 做法 也 不难 , 不 复杂 。 ||| F0= -0.13551054894924164 ||| -0.13551054894924164
0 ||| 冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.13648469746112823 ||| -0.13648469746112823
0 ||| “ 冬阴功 ” 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14135058224201202 ||| -0.14135058224201202
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味儿 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.143321692943573 ||| -0.143321692943573
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 香味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.143504798412323 ||| -0.143504798412323
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 虽然 它 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14606299996376038 ||| -0.14606299996376038
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 奢华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14855249226093292 ||| -0.14855249226093292

The nbest list after augmentation(${output_dir}/output.tok.nbest.reformat.augmented.txt) is as follows:

0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.04735666885972023 EditOps0= 0 0 0   ||| -0.04735666885972023
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味道 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.06592220067977905 EditOps0= 0 0 1   ||| -0.06592220067977905
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.1047820895910263 EditOps0= 2 0 0   ||| -0.1047820895910263
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 , 不 复杂 。 ||| F0= -0.1169404685497284 EditOps0= 0 0 1   ||| -0.1169404685497284
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 口味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.12856733798980713 EditOps0= 0 0 1   ||| -0.12856733798980713
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味道 确实 让 人 上瘾 , 做法 也 不难 , 不 复杂 。 ||| F0= -0.13551054894924164 EditOps0= 0 0 2   ||| -0.13551054894924164
0 ||| 冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.13648469746112823 EditOps0= 1 0 0   ||| -0.13648469746112823
0 ||| “ 冬阴功 ” 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14135058224201202 EditOps0= 0 1 1   ||| -0.14135058224201202
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 味儿 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.143321692943573 EditOps0= 0 0 1   ||| -0.143321692943573
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 豪华 , 但 它 的 香味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.143504798412323 EditOps0= 0 0 1   ||| -0.143504798412323
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 虽然 它 不是 很 豪华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14606299996376038 EditOps0= 1 1 0   ||| -0.14606299996376038
0 |||  冬阴功 是 泰国 最 著名 的 菜 之一 , 它 虽然 不是 很 奢华 , 但 它 的 味 确实 让 人 上瘾 , 做法 也 不难 、 不 复杂 。 ||| F0= -0.14855249226093292 EditOps0= 0 0 1   ||| -0.14855249226093292

And the weights of the reranker are trained successfully(${train_reranker_output_dir}/weights.eo.txt):

0.910415 0.0390036 0.0223347 0.0282471 

And I also tried modify train_reranker.sh and run_trained_model.sh to rerank nbest output only using the language model feature, but still the same error~

from mlconvgec2018.

shamilcm avatar shamilcm commented on August 19, 2024

I could rerank the above n-best list (with 1 example) and your weights file with no issue. Can you send the full file?
image

from mlconvgec2018.

shamilcm avatar shamilcm commented on August 19, 2024

You could try to check the same?

python rerank.py -i test/nbest -w test/weights -o test/outnbest --clean-up

Put your nbest list with the single example that you gave above and your weights file. See if it works with a single example first.

from mlconvgec2018.

young-zonglin avatar young-zonglin commented on August 19, 2024

emm, even if there is only one sample, it still doesn't work:
Screenshot from 2019-03-12 10-38-33
The file content and output dir:
Screenshot from 2019-03-12 10-39-39

from mlconvgec2018.

young-zonglin avatar young-zonglin commented on August 19, 2024

Very very thank you for your help!

from mlconvgec2018.

wulouzhu avatar wulouzhu commented on August 19, 2024

@young-zonglin
When I used python3, I got the same error as you. But when I used python2, another error happended. Did you meet this problem.Thank you.

Traceback (most recent call last):
  File "software/nbest-reranker/rerank.py", line 81, in <module>
    output_1best.write(group[sorted_indices[0]].hyp + "\n")
IndexError: list index out of range

from mlconvgec2018.

Related Issues (20)

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.