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 GLM-4 CPU example #11223

Merged
merged 4 commits into from
Jun 12, 2024
Merged

Conversation

JinBridger
Copy link
Contributor

No description provided.

@glorysdj glorysdj requested a review from hzjane June 5, 2024 08:33
@Oscilloscope98 Oscilloscope98 requested review from glorysdj, qiuxin2012 and Oscilloscope98 and removed request for glorysdj June 11, 2024 02:11
@JinBridger
Copy link
Contributor Author

(jinqiao-llm-0612) arda@arda-arc21:~/jinqiao$ python generate.py --repo-id-or-model-path /mnt/disk1/models/glm-4-9b-chat/
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 41.15it/s]
2024-06-12 09:59:29,390 - INFO - Converting the current model to sym_int4 format......
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
  File "/home/arda/jinqiao/generate.py", line 61, in <module>
    output = model.generate(input_ids,
             ^^^^^^^^^^^^^^^^^^^^^^^^^
......
  File "/home/arda/miniforge3/envs/jinqiao-llm-0612/lib/python3.11/site-packages/ipex_llm/transformers/models/chatglm4.py", line 342, in core_attn_forward
    key_layer.transpose(2, 3)) / math.sqrt(head_dim)
                                 ^^^^
NameError: name 'math' is not defined

Looks like we need import math in transformers/models/chatglm4.py ?

@Oscilloscope98
Copy link
Contributor

(jinqiao-llm-0612) arda@arda-arc21:~/jinqiao$ python generate.py --repo-id-or-model-path /mnt/disk1/models/glm-4-9b-chat/
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 41.15it/s]
2024-06-12 09:59:29,390 - INFO - Converting the current model to sym_int4 format......
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
  File "/home/arda/jinqiao/generate.py", line 61, in <module>
    output = model.generate(input_ids,
             ^^^^^^^^^^^^^^^^^^^^^^^^^
......
  File "/home/arda/miniforge3/envs/jinqiao-llm-0612/lib/python3.11/site-packages/ipex_llm/transformers/models/chatglm4.py", line 342, in core_attn_forward
    key_layer.transpose(2, 3)) / math.sqrt(head_dim)
                                 ^^^^
NameError: name 'math' is not defined

Looks like we need import math in transformers/models/chatglm4.py ?

It will be fixed in #11276. We may use 2.1.0b20240606 for sample output now :)

@Oscilloscope98 Oscilloscope98 merged commit f224e98 into intel-analytics:main Jun 12, 2024
26 checks passed
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.

2 participants