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

add internvl2 example #12102

Merged
merged 5 commits into from
Sep 20, 2024
Merged

add internvl2 example #12102

merged 5 commits into from
Sep 20, 2024

Conversation

ch1y0q
Copy link
Contributor

@ch1y0q ch1y0q commented Sep 20, 2024

Description

1. Why the change?

2. User API changes

3. Summary of the change

4. How to test?

  • N/A
  • Unit test: Please manually trigger the PR Validation here by inputting the PR number (e.g., 1234). And paste your action link here once it has been successfully finished.
  • Application test
  • Document test
  • ...

5. New dependencies

  • New Python dependencies
    - Dependency1
    - Dependency2
    - ...
  • New Java/Scala dependencies and their license
    - Dependency1 and license1
    - Dependency2 and license2
    - ...

# When running LLMs on Intel iGPUs for Windows users, we recommend setting `cpu_embedding=True` in the from_pretrained function.
# This will allow the memory-intensive embedding layer to utilize the CPU instead of iGPU.
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True,
load_in_low_bit="sym_int4",
Copy link
Contributor

Choose a reason for hiding this comment

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

fix the code style

"max_new_tokens": 64,
"do_sample": False,
}

Copy link
Contributor

@rnwang04 rnwang04 Sep 20, 2024

Choose a reason for hiding this comment

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

add with torch.inference_mode(): context manager for inference

question = "<image>" + query

generation_config = {
"max_new_tokens": 64,
Copy link
Contributor

Choose a reason for hiding this comment

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

make it as a parameter

@rnwang04
Copy link
Contributor

@jason-dai
Copy link
Contributor

Copy link
Contributor

@rnwang04 rnwang04 left a comment

Choose a reason for hiding this comment

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

LGTM

@rnwang04 rnwang04 merged commit 2269768 into intel-analytics:main Sep 20, 2024
1 check passed
@ch1y0q ch1y0q deleted the npu-internvl2-4b branch September 20, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants