Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Conversation

@Gasoonjia
Copy link
Contributor

@Gasoonjia Gasoonjia commented Sep 27, 2024

Before this diff, openai api and cli has their own pipeline to convert the user's input into model's input. We have to maintain both of them to make them up-to-date.

This PR unifies the model input generation pipeline to make openai api support text-only input, just like cli right now, and makes the pipeline more stable and maintainable.

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 27, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/1219

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 5f08656 with merge base e4b36f9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@Gasoonjia Gasoonjia changed the title Unify input gen Unify Input Generation for CLI and Openai API Sep 27, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 27, 2024
torchtune_contents = []
if isinstance(message["content"], list):
for content_dict in message["content"]:
converted_content = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused arg

print("Starting Interactive Chat")
def _gen_model_input(self, prompt: str, image_prompts: Optional[List[str | Image.Image]] = None, max_new_tokens: Optional[int] = None) -> Tuple:
assert image_prompts is None or len(image_prompts) == 1, "At most one image is supported at the moment"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert image_prompts is None or len(image_prompts) == 1, "At most one image is supported at the moment"
assert image_prompts is None or len(image_prompts) <= 1, "At most one image is supported at the moment"

@Jack-Khuu Jack-Khuu merged commit 8278aa2 into main Sep 28, 2024
52 checks passed
metascroy pushed a commit that referenced this pull request Sep 30, 2024
* support text-only input with llama3.2-11b

* unify model generation between openai api and cli

* Update typos

* remove used arg

---------

Co-authored-by: Jack-Khuu <jack.khuu.7@gmail.com>
@Jack-Khuu Jack-Khuu deleted the unify-input-gen branch October 5, 2024 02:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants