Code Monkey home page Code Monkey logo

turjuman's Issues

Token ids generated instead of translation

Hey there, I hope you're doing fine.
when running the command: turj.translate
it returns the token ids instead of the actual translation?
(see the output below)
2022-07-07 10:41:43 | INFO | turjuman.translate | Using beam search
tensor([[ 0, 6538, 2, 76, 6380, 1]])

Error in Colab Example

When running the following command, the error presented below is raised:

Beam search is the default generation method on Turjuman
!turjuman_translate --text "As US reaches one million COVID deaths, how are Americans coping?"

IndexError: too many indices for tensor of dimension 2

/usr/local/bin/turjuman_translate:8 in <module>                              │
│                                                                              │
│   5 from turjuman_cli.translate import translate_cli                         │
│   6 if __name__ == '__main__':                                               │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])     │
│ ❱ 8 │   sys.exit(translate_cli())                                            │
│   9                                                                          │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/turjuman_cli/translate.py:76 in       │
│ translate_cli                                                                │
│                                                                              │
│   73 │                                                                       │
│   74 │   torj = turjuman(logger, args.cache_dir)                             │
│   75 │   if input_source=="text":                                            │
│ ❱ 76 │   │   torj.translate_from_text (args.text, args.search_method, args.s │
│   77 │   elif input_source=="file":                                          │
│   78 │   │   torj.translate_from_file (args.input_file, args.search_method,  │
│   79                                                                         │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/turjuman/turjuman.py:93 in            │
│ translate_from_text                                                          │
│                                                                              │
│    90 │   │   outputs = self.translate(sources, search_method, seq_length, m │
│    91 │   │                                                                  │
│    92 │   │   if max_outputs==1:                                             │
│ ❱  93 │   │   │   targets = outputs['target'][0]                             │
│    94 │   │   else:                                                          │
│    95 │   │   │   targets = outputs[str(max_outputs)+'_targets'][0]          │
│    96 │   │   if type(targets) == list:     

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.