Giter Site home page Giter Site logo

hlt-mt / fbk-fairseq Goto Github PK

View Code? Open in Web Editor NEW
28.0 6.0 0.0 7.47 MB

Repository containing the open source code of works published at the FBK MT unit.

License: Other

Python 97.63% C++ 0.55% Cuda 1.27% Cython 0.37% Shell 0.03% Lua 0.15%
deep-learning pytorch speech-to-text speech-translation gender-bias simultaneous-translation subtitling

fbk-fairseq's Introduction

FBK-fairseq

This repository contains the open source code by the MT unit of FBK. Dedicated README for each work can be found in the fbk_works directory.

2024

2023

2022

2021

If using this repository, please acknowledge the related paper(s) citing them. Bibtex citations are available for each work in the dedicated README file.

To install the repository, do:

pip install -e .
pip install -r speech_requirements.txt  # required for speech translation

Below, there is the original Fairseq README file.




MIT License Latest Release Build Status Documentation Status


Fairseq(-py) is a sequence modeling toolkit that allows researchers and developers to train custom models for translation, summarization, language modeling and other text generation tasks.

We provide reference implementations of various sequence modeling papers:

List of implemented papers

What's New:

Previous updates

Features:

We also provide pre-trained models for translation and language modeling with a convenient torch.hub interface:

en2de = torch.hub.load('pytorch/fairseq', 'transformer.wmt19.en-de.single_model')
en2de.translate('Hello world', beam=5)
# 'Hallo Welt'

See the PyTorch Hub tutorials for translation and RoBERTa for more examples.

Requirements and Installation

  • PyTorch version >= 1.5.0
  • Python version >= 3.6
  • For training new models, you'll also need an NVIDIA GPU and NCCL
  • To install fairseq and develop locally:
git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./

# on MacOS:
# CFLAGS="-stdlib=libc++" pip install --editable ./

# to install the latest stable release (0.10.0)
# pip install fairseq==0.10.0
  • For faster training install NVIDIA's apex library:
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" \
  --global-option="--deprecated_fused_adam" --global-option="--xentropy" \
  --global-option="--fast_multihead_attn" ./
  • For large datasets install PyArrow: pip install pyarrow
  • If you use Docker make sure to increase the shared memory size either with --ipc=host or --shm-size as command line options to nvidia-docker run .

Getting Started

The full documentation contains instructions for getting started, training new models and extending fairseq with new model types and tasks.

Pre-trained models and examples

We provide pre-trained models and pre-processed, binarized test sets for several tasks listed below, as well as example training and evaluation commands.

We also have more detailed READMEs to reproduce results from specific papers:

Join the fairseq community

License

fairseq(-py) is MIT-licensed. The license applies to the pre-trained models as well.

Citation

Please cite as:

@inproceedings{ott2019fairseq,
  title = {fairseq: A Fast, Extensible Toolkit for Sequence Modeling},
  author = {Myle Ott and Sergey Edunov and Alexei Baevski and Angela Fan and Sam Gross and Nathan Ng and David Grangier and Michael Auli},
  booktitle = {Proceedings of NAACL-HLT 2019: Demonstrations},
  year = {2019},
}

fbk-fairseq's People

Contributors

alexeib avatar cndn avatar davidecaroselli avatar deanfcc avatar edunov avatar erip avatar freewym avatar halilakin avatar huihuifan avatar jhcross avatar jma127 avatar joshim5 avatar kahne avatar kartikayk avatar lematt1991 avatar liezl200 avatar liuchen9494 avatar louismartin avatar maigoakisame avatar mgaido91 avatar multipath avatar myleott avatar nng555 avatar pipibjc avatar sarapapi avatar shruti-bh avatar skritika avatar tangyuq avatar theweiho avatar xu-song 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fbk-fairseq's Issues

Can't get EDATT to work

I cloned the FBK-fairseq repo (https://github.com/hlt-mt/FBK-fairseq.git), installed it following the instructions here, and tried to run the EDATT model on the SiMT task as described here, but it gives me some weird error:

Traceback (most recent call last):
File "/work/miniconda/envs/fbk/bin/simuleval", line 8, in
sys.exit(main())
File "/work/miniconda/envs/fbk/lib/python3.10/site-packages/simuleval/cli.py", line 165, in main
_main(args.client_only)
File "/work/miniconda/envs/fbk/lib/python3.10/site-packages/simuleval/cli.py", line 180, in _main
_, agent_cls = find_agent_cls(args)
File "/work/miniconda/envs/fbk/lib/python3.10/site-packages/simuleval/utils/agent_finder.py", line 64, in find_agent_cls
spec.loader.exec_module(agent_modules)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/work/FBK-fairseq/examples/speech_to_text/simultaneous_translation/agents/simul_offline_edatt.py", line 18, in
from examples.speech_to_text.simultaneous_translation.agents.base_simulst_agent import FairseqSimulSTAgent
ModuleNotFoundError: No module named 'examples'

What I am doing wrong?

[Question for AlignAtt]

Hi, thank you so much for your great work and ope access.

I'd like to reproduce AlignAtt, especially to replicate data preparation and trainig.

Can you provide a guide containing a script or command for data-prepration and traing?

Thanks,

TypeError: cannot unpack non-iterable NoneType object

🐛 Bug

Hey! I tried following the instructions here to run the AlignATT agent on the en->es direction model. I git clone and (editable) installed this repo and SimulEval, downloaded the checkpoint and all the associated metadata files to /workspace/FBK-fairseq/checkpoint/ and ran the following command:

!simuleval \
    --agent examples/speech_to_text/simultaneous_translation/agents/v1_0/simul_offline_alignatt.py \
    --source /workspace/source.txt \
    --target /workspace/target.txt \
    --config config_simul.yaml \
    --model-path /workspace/FBK-fairseq/checkpoint/checkpoint_avg7.pt \
    --extract-attn-from-layer 3 \
    --frame-num 4 \
    --speech-segment-factor 10 \
    --output /content/ \
    --port 8000 \
    --gpu \
    --scores

and got the following error

Traceback (most recent call last):
  File "/usr/local/bin/simuleval", line 33, in <module>
    sys.exit(load_entry_point('simuleval', 'console_scripts', 'simuleval')())
  File "/workspace/SimulEval/simuleval/cli.py", line 165, in main
    _main(args.client_only)
  File "/workspace/SimulEval/simuleval/cli.py", line 180, in _main
    _, agent_cls = find_agent_cls(args)
  File "/workspace/SimulEval/simuleval/utils/agent_finder.py", line 64, in find_agent_cls
    spec.loader.exec_module(agent_modules)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/workspace/FBK-fairseq/examples/speech_to_text/simultaneous_translation/agents/v1_0/simul_offline_alignatt.py", line 17, in <module>
    from examples.speech_to_text.simultaneous_translation.agents.v1_0.simul_offline_edatt import EDAttSTAgent
  File "/workspace/FBK-fairseq/examples/speech_to_text/__init__.py", line 6, in <module>
    from . import tasks, criterions, models, modules  # noqa
  File "/workspace/FBK-fairseq/examples/speech_to_text/tasks/__init__.py", line 7, in <module>
    importlib.import_module('examples.speech_to_text.tasks.' + task_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/workspace/FBK-fairseq/examples/speech_to_text/tasks/speech_translation_dualdecoding.py", line 17, in <module>
    from examples.speech_to_text.inference.twophase_sequence_generator import TwoPhaseSequenceGenerator
  File "/workspace/FBK-fairseq/examples/speech_to_text/inference/twophase_sequence_generator.py", line 21, in <module>
    from examples.speech_to_text.models.base_triangle_with_prev_tags import BaseTrianglePreviousTags
  File "/workspace/FBK-fairseq/examples/speech_to_text/models/__init__.py", line 7, in <module>
    importlib.import_module('examples.speech_to_text.models.' + model_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/workspace/FBK-fairseq/examples/speech_to_text/models/speechformer_triangle.py", line 14, in <module>
    from examples.speech_to_text.models.base_triangle import BaseTriangle
  File "/workspace/FBK-fairseq/examples/speech_to_text/models/base_triangle.py", line 20, in <module>
    from examples.speech_to_text.modules.triangle_transformer_layer import TriangleTransformerDecoderLayer
  File "/workspace/FBK-fairseq/examples/speech_to_text/modules/__init__.py", line 7, in <module>
    importlib.import_module('examples.speech_to_text.modules.' + module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/workspace/FBK-fairseq/examples/speech_to_text/modules/transformer_layer_penalty.py", line 10, in <module>
    from examples.speech_to_text.modules.local_attention import LocalAttention
  File "/workspace/FBK-fairseq/examples/speech_to_text/modules/local_attention.py", line 11, in <module>
    from fairseq import utils
  File "/workspace/FBK-fairseq/fairseq/__init__.py", line 33, in <module>
    import fairseq.optim  # noqa
  File "/workspace/FBK-fairseq/fairseq/optim/__init__.py", line 27, in <module>
    (
TypeError: cannot unpack non-iterable NoneType object

To Reproduce

Steps to reproduce the behavior (always include the command you ran):

  1. Run cmd '....'
  2. See error

Code sample

Expected behavior

Environment

  • fairseq Version (e.g., 1.0 or master): master
  • PyTorch Version (e.g., 1.0)
  • OS (e.g., Linux): Linux
  • How you installed fairseq (pip, source):
  • Build command you used (if compiling from source):
  • Python version:
  • CUDA/cuDNN version:
  • GPU models and configuration: 4090
  • Any other relevant information:

Additional context

About NE emb

Would you mind introduce the 'NE emb' detailly? How to get the vector of it? Thanks!

train about task speech_to_text_tagged

using the command in readme,i can't get the same bleu on task speech_to_text_tagged.and i had add ner tag in dict.is it my dict or data preprocess wrong.can you share about the dict of mustc dataset?thanks a lot.

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.