-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
127 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
examples/music_caption/README.md → examples/mc_musiccaps/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import torch | ||
import os | ||
import logging | ||
from slam_llm.models.slam_model import ( | ||
slam_model, | ||
setup_tokenizer, | ||
setup_encoder, | ||
setup_encoder_projector, | ||
setup_llm, | ||
) | ||
from slam_llm.utils.train_utils import print_model_size | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
def model_factory(train_config, model_config, **kwargs): | ||
# return necessary components for training | ||
tokenizer = setup_tokenizer(train_config, model_config, **kwargs) | ||
|
||
encoder = setup_encoder(train_config, model_config, **kwargs) | ||
|
||
# llm | ||
llm = setup_llm(train_config, model_config, **kwargs) | ||
|
||
# projector | ||
encoder_projector = setup_encoder_projector( | ||
train_config, model_config, **kwargs | ||
) | ||
model = slam_model_mir( | ||
encoder, | ||
llm, | ||
encoder_projector, | ||
tokenizer, | ||
train_config, | ||
model_config, | ||
**kwargs, | ||
) | ||
|
||
ckpt_path = kwargs.get( | ||
"ckpt_path", None | ||
) # FIX(MZY): load model ckpt(mainly projector, related to model_checkpointing/checkpoint_handler.py: save_model_checkpoint_peft) | ||
|
||
if ckpt_path is not None: | ||
logger.info("loading other parts from: {}".format(ckpt_path)) | ||
ckpt_dict = torch.load(ckpt_path, map_location="cpu") | ||
model.load_state_dict(ckpt_dict, strict=False) | ||
|
||
print_model_size( | ||
model, | ||
train_config, | ||
( | ||
int(os.environ["RANK"]) | ||
if train_config.enable_fsdp or train_config.enable_ddp | ||
else 0 | ||
), | ||
) | ||
return model, tokenizer | ||
|
||
|
||
class slam_model_mir(slam_model): | ||
def __init__( | ||
self, | ||
encoder, | ||
llm, | ||
encoder_projector, | ||
tokenizer, | ||
train_config, | ||
model_config, | ||
**kwargs, | ||
): | ||
super().__init__( | ||
encoder, | ||
llm, | ||
encoder_projector, | ||
tokenizer, | ||
train_config, | ||
model_config, | ||
**kwargs, | ||
) |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,7 @@ build-backend = "hatchling.build" | |
[project] | ||
name = "slam-llm" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="Hamid Shojanazeri", email="[email protected]" }, | ||
{ name="Matthias Reso", email="[email protected]" }, | ||
{ name="Geeta Chauhan", email="[email protected]" }, | ||
] | ||
description = "To be done" | ||
description = "SLAM-LLM is a deep learning toolkit that allows researchers and developers to train custom multimodal large language model (MLLM), focusing on Speech, Language, Audio, Music processing. We provide detailed recipes for training and high-performance checkpoints for inference." | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
|
@@ -26,8 +21,8 @@ tests = ["pytest-mock"] | |
auditnlg = ["auditnlg"] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/facebookresearch/llama-recipes/" | ||
"Bug Tracker" = "https://github.com/facebookresearch/llama-recipes/issues" | ||
"Homepage" = "https://github.com/ddlBoJack/SLAM-LLM" | ||
"Bug Tracker" = "https://github.com/ddlBoJack/SLAM-LLM/issues" | ||
|
||
[tool.hatch.build] | ||
exclude = [ | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.