Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fairseq 0.12.2 ❄️ #1

Merged
merged 23 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions abs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
upload_channels:
- sfe1ed40
2 changes: 2 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytorch_variant:
- cpu
115 changes: 100 additions & 15 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{% set version = "0.12.3" %}

{% set name = "fairseq" %}
{% set version = "0.12.2" %}

package:
name: fairseq
version: {{ version }}

source:
url: https://github.com/pytorch/fairseq/archive/refs/tags/v{{ version }}.tar.gz
sha256: f9e97dc0ff6a9f5c4f29fcf297c2fa4d16a2ca7f6dbd180286855e31e1cb3183
url: https://github.com/facebookresearch/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz
sha256: b5bb076f8b0d5b06a897b11627da278816752b2202650c34becd8f4240f86961
patches:
# following conda-forge pinnings.
- patches/0001-remove-upper-bounds.patch

build:
number: 6
number: 0
entry_points:
- fairseq-eval-lm = fairseq_cli.eval_lm:cli_main
- fairseq-generate = fairseq_cli.generate:cli_main
Expand All @@ -20,29 +23,38 @@ build:
- fairseq-score = fairseq_cli.score:cli_main
- fairseq-train = fairseq_cli.train:cli_main
- fairseq-validate = fairseq_cli.validate:cli_main
script: {{ PYTHON }} -m pip install . -vv
skip: true # [win]
script:
# compiling Cython token_block_utils_fast.pyx module so it can be imported
# https://github.com/facebookresearch/fairseq/blob/v0.12.2/.github/workflows/build.yml#L37
- {{ PYTHON }} setup.py build_ext --inplace
boldorider4 marked this conversation as resolved.
Show resolved Hide resolved
- {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
missing_dso_whitelist:
- $RPATH/libtorch_cpu.so # [linux]
- $RPATH/libtorch_cpu.dylib # [osx]
- $RPATH/libtorch_python.so # [linux]
- $RPATH/libc10.so # [linux]
- $RPATH/libtorch_python.dylib # [osx]
- $RPATH/libc10.dylib # [osx]
boldorider4 marked this conversation as resolved.
Show resolved Hide resolved
skip: true # [win or s390x]
# fairseq still does not support python 3.11
# https://github.com/facebookresearch/fairseq/pull/5359/files
skip: true # [py>=311]

requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- cython # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- pytorch # [build_platform != target_platform]
- {{ compiler('c') }}
- {{ stdlib("c") }}
- {{ compiler('cxx') }}
- patch # [not win]
- m2-patch # [win]
host:
- pybind11
- python
- pip
- numpy
- cython
- setuptools
# It's required to build the CPP extensions.
- wheel
# It's required to build the CPP extensions.q
- pytorch
run:
- python
Expand All @@ -53,25 +65,98 @@ requirements:
- sacrebleu >=1.4.12
- tqdm
- bitarray
- pytorch
- cffi
- cython
- torchaudio >=0.8.0

{% set tests_to_skip = "" %}

{% set tests_to_skip = " test_data_utils" %}
# # missing CUDA error, but we don't need to build CUDA-compatible fairseq
{% set tests_to_skip = tests_to_skip + " or test_fp16_for_long_input" %}

# # skipping because "soft_energy" KeyError that seems to be missing from a dict defined in files within examples/ directory
{% set tests_to_skip = tests_to_skip + " or test_expected_attention" %}

# # skipping these because we don't have xformers
{% set tests_to_skip = tests_to_skip + " or test_xformers_single_forward_parity" %}

# # skipping these because we don't have iopath
{% set tests_to_skip = tests_to_skip + " or test_file_io_async" %}
{% set tests_to_skip = tests_to_skip + " or test_xformers_single_forward_parity" %}

# RuntimeError: Mask Type should be defined
# According to issue, fixed on main, but not in 0.12.2.
# https://github.com/facebookresearch/fairseq/issues/4858#issuecomment-1313135905
{% set tests_to_skip = tests_to_skip + " or test_alignment" %}
{% set tests_to_skip = tests_to_skip + " or test_alignment_full_context" %}
{% set tests_to_skip = tests_to_skip + " or test_cmlm_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_insertion_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_iterative_nonautoregressive_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_mixture_of_experts" %}
{% set tests_to_skip = tests_to_skip + " or test_multilingual_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_nonautoregressive_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_transformer_cross_self_attention" %}
{% set tests_to_skip = tests_to_skip + " or test_transformer_pointer_generator" %}
{% set tests_to_skip = tests_to_skip + " or test_translation_multi_simple_epoch" %}
{% set tests_to_skip = tests_to_skip + " or test_translation_multi_simple_epoch_dicts" %}
{% set tests_to_skip = tests_to_skip + " or test_translation_multi_simple_epoch_no_vepoch" %}
{% set tests_to_skip = tests_to_skip + " or test_translation_multi_simple_epoch_src_tgt_dict_spec" %}
{% set tests_to_skip = tests_to_skip + " or test_activation_checkpointing_does_not_change_metrics" %}
{% set tests_to_skip = tests_to_skip + " or test_activation_offloading_does_not_change_metrics" %}
{% set tests_to_skip = tests_to_skip + " or test_mask_for_xformers" %}

# requires examples, but skipping examples import due to segmentation fault from the size of examples
{% set tests_to_skip = tests_to_skip + " or test_laser_lstm" %}
{% set tests_to_skip = tests_to_skip + " or test_laser_transformer" %}
{% set tests_to_skip = tests_to_skip + " or test_linformer_roberta_masked_lm" %}
{% set tests_to_skip = tests_to_skip + " or test_linformer_roberta_regression_multiple" %}
{% set tests_to_skip = tests_to_skip + " or test_linformer_roberta_regression_single" %}
{% set tests_to_skip = tests_to_skip + " or test_linformer_roberta_sentence_prediction" %}
{% set tests_to_skip = tests_to_skip + " or test_r4f_roberta" %}
{% set tests_to_skip = tests_to_skip + " or test_waitk_checkpoint" %}
{% set tests_to_skip = tests_to_skip + " or test_multilingual_translation_latent_depth" %}
{% set tests_to_skip = tests_to_skip + " or test_roberta_incremental_decoder" %}

test:
source_files:
- tests
- scripts/average_checkpoints.py
requires:
- pytest
- hypothesis
- expecttest
- pip
- tensorboardx
imports:
- fairseq
- fairseq.benchmark
commands:
- pip check
- fairseq-eval-lm --help
- fairseq-generate --help
- fairseq-interactive --help
- fairseq-preprocess --help
- fairseq-score --help
- fairseq-train --help
- fairseq-validate --help
# all ignored tests are using examples, which causes segmentation when imported
- pytest -vv . --ignore=tests/speech_recognition/test_collaters.py --ignore=tests/speech_recognition/test_cross_entropy.py --ignore=tests/speech_recognition/test_data_utils.py --ignore=tests/speech_recognition/test_vggtransformer.py -k "not({{ tests_to_skip }})"
boldorider4 marked this conversation as resolved.
Show resolved Hide resolved

about:
home: https://github.com/pytorch/fairseq
home: https://github.com/facebookresearch/fairseq
summary: Facebook AI Research Sequence-to-Sequence Toolkit
description: |
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.
license: MIT
license_file: LICENSE
license_family: MIT
dev_url: https://github.com/facebookresearch/fairseq
doc_url: https://fairseq.readthedocs.io/

extra:
recipe-maintainers:
Expand Down
27 changes: 27 additions & 0 deletions recipe/patches/0001-remove-upper-bounds.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 88b437f4af344473ba0dcc5c83afbe9bce482fb1 Mon Sep 17 00:00:00 2001
From: Udo-Peter Steyer <[email protected]>
Date: Thu, 19 Sep 2024 12:20:49 -0500
Subject: [PATCH] remove upper bounds

psteyer marked this conversation as resolved.
Show resolved Hide resolved
---
setup.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index a7ce61a8..b639cbe7 100644
--- a/setup.py
+++ b/setup.py
@@ -200,8 +200,8 @@ def do_setup(package_data):
"cffi",
"cython",
'dataclasses; python_version<"3.7"',
- "hydra-core>=1.0.7,<1.1",
- "omegaconf<2.1",
+ "hydra-core>=1.0.7",
+ "omegaconf",
'numpy<1.20.0; python_version<"3.7"',
'numpy; python_version>="3.7"',
"regex",
--
2.39.3 (Apple Git-146)