-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Adjust setup.py. Map scripts to binary names. Adjust Readme docs. #23
Changes from all commits
88121ac
a03dfb8
16bc4a5
e68b367
f05b1dc
08a8edd
5f61873
ef75a7a
3fd941e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,3 +139,8 @@ wandb/ | |
nohup.out | ||
multirun | ||
outputs | ||
|
||
|
||
# symlinks | ||
seamless_communication | ||
m4t_scripts | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pytest | ||
black | ||
flake8 | ||
isort |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ datasets | |
torchaudio | ||
soundfile | ||
librosa | ||
fairseq2==0.1.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,70 @@ | |
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from pathlib import Path | ||
import os | ||
from typing import Iterable | ||
|
||
import pkg_resources | ||
from setuptools import find_packages, setup | ||
from setuptools.command.develop import develop | ||
|
||
|
||
def _load_requirements(fname: str) -> Iterable[str]: | ||
with open(Path(__file__).parent / fname) as fp_in: | ||
for req in pkg_resources.parse_requirements(fp_in): | ||
yield str(req) | ||
|
||
|
||
def _add_symlinks(): | ||
root = Path(__file__).parent | ||
sc_root = root / "src/seamless_communication" | ||
sc_link = root / "seamless_communication" | ||
m4t_scripts_root = root / "scripts/m4t" | ||
m4t_scripts_link = root / "m4t_scripts" | ||
if not sc_link.exists(): | ||
os.symlink(sc_root, sc_link, target_is_directory=True) | ||
if not m4t_scripts_link.exists(): | ||
os.symlink(m4t_scripts_root, m4t_scripts_link, target_is_directory=True) | ||
|
||
|
||
class cmd_for_editable_mode(develop): | ||
def run(self): | ||
# add symlinks for modules if install in editable mode | ||
_add_symlinks() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I am missing something, but are these symlinks necessary? Normally There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Editable mode of Python creates a symlink in site-packages to the module's parent folder. This logic does not work if you have more than one module to expose and they don't share their parent folder. |
||
super().run() | ||
|
||
|
||
default_requirements = list(_load_requirements("requirements.txt")) | ||
dev_requirements = list(_load_requirements("dev_requirements.txt")) | ||
|
||
setup( | ||
name="seamless_communication", | ||
version="0.1", | ||
packages=find_packages(where="src"), | ||
package_dir={"": "src"}, | ||
package_data={"": ["assets/cards/*.yaml"]}, | ||
version="1.0.0", | ||
packages=find_packages(where="src") | ||
+ ["m4t_scripts.finetune", "m4t_scripts.predict"], | ||
package_dir={ | ||
"m4t_scripts": "scripts/m4t", | ||
"seamless_communication": "src/seamless_communication", | ||
}, | ||
package_data={"": ["seamless_communication/assets/cards/*.yaml"]}, | ||
description="SeamlessM4T -- Massively Multilingual & Multimodal Machine Translation Model", | ||
long_description=open("README.md", encoding="utf-8").read(), | ||
long_description_content_type="text/markdown", | ||
readme="README.md", | ||
python_requires=">=3.8", | ||
author="Fundamental AI Research (FAIR) at Meta", | ||
url="https://github.com/facebookresearch/seamless_communication", | ||
license="Creative Commons", | ||
install_requires=default_requirements, | ||
extras_require={"dev": default_requirements + dev_requirements}, | ||
entry_points={ | ||
"console_scripts": [ | ||
"m4t_predict=m4t_scripts.predict.predict:main", | ||
"m4t_finetune=m4t_scripts.finetune.finetune:main", | ||
"m4t_prepare_dataset=m4t_scripts.finetune.dataset:main", | ||
], | ||
}, | ||
cmdclass={"develop": cmd_for_editable_mode}, | ||
include_package_data=True, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What Ruslan means by "more than one module to expose" @cbalioglu