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

Documentation is not up-to-date #205

Open
quic-shagun opened this issue Dec 23, 2024 · 2 comments
Open

Documentation is not up-to-date #205

quic-shagun opened this issue Dec 23, 2024 · 2 comments

Comments

@quic-shagun
Copy link
Contributor

Describe the bug
I was trying to use the high level APIs of QEff to integrate LLM into my application using the documentation here: https://quic.github.io/efficient-transformers/source/hl_api.html#qeffautomodelforcausallm

Platform and Apps SDK: 1.18.3.18

I got the following errors:

  1. --device_group is not a valid option
Compiler exitcode: 1
Compiler stderr:
Invalid option -device-group=[0]. Use -h, -help, or --help for list of options.
  1. After removing the device_group as an argument:
Traceback (most recent call last):
  File "/prj/qct/aisyssol_scratch/users/shagsood/coreEdge/qeff.py", line 10, in <module>
    model.generate(prompts=["Hi there!!"])
TypeError: QEFFAutoModelForCausalLM.generate() missing 1 required positional argument: 'tokenizer'

It's not mentioned anywhere that tokenizer is a mandatory argument both in documentation and code

To Reproduce
I use the python script example shared in the documentation:

from QEfficient import QEFFAutoModelForCausalLM

# Initialize the model using from_pretrained similar to transformers.AutoModelForCausalLM
model = QEFFAutoModelForCausalLM.from_pretrained("gpt2")

# Now you can directly compile the model for Cloud AI 100
model.compile(num_cores=14, device_group=[0])  # Considering you have a Cloud AI 100 Standard SKU

# You can now execute the model
model.generate(prompts=["Hi there!!"])

Expected behavior
I made the code work by making the following changes:

from QEfficient import QEFFAutoModelForCausalLM
from QEfficient.utils import load_hf_tokenizer

# Initialize the model using from_pretrained similar to transformers.AutoModelForCausalLM
model = QEFFAutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")

# Now you can directly compile the model for Cloud AI 100
model.compile(num_cores=16)  # Considering you have a Cloud AI 100 Standard SKU

tokenizer = load_hf_tokenizer(
        pretrained_model_name_or_path="meta-llama/Llama-3.2-1B-Instruct"
    )

# You can now execute the model
model.generate(prompts=["Hi there!!"],tokenizer=tokenizer)

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Environment details with packages version etc.
  • Version/Branch/Commit ID [e.g. 22]

Additional context
Add any other context about the problem here.

@quic-rishinr
Copy link
Contributor

Hi @quic-shagun we recently updated the compile and generate functions but missed updating the example scripts. Thanks for pointing this out. We will get it updated shortly.

@quic-rishinr
Copy link
Contributor

Hi @quic-shagun, we've updated the example scripts. Could you please review them?

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

No branches or pull requests

2 participants