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

IXC-2.5-Reward inference error #482

Open
zhang123434 opened this issue Mar 11, 2025 · 0 comments
Open

IXC-2.5-Reward inference error #482

zhang123434 opened this issue Mar 11, 2025 · 0 comments
Assignees

Comments

@zhang123434
Copy link

zhang123434 commented Mar 11, 2025

@yuhangzang @panzhang0212 我的环境是安装readme.txt里面安装的,版本都是一致的,权重我下载好到了本地目录:./internlm-xcomposer2d5-7b-reward下,下面是推理的代码:

import torch
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained(
    "./internlm-xcomposer2d5-7b-reward", 
    device_map="cuda", 
    torch_dtype=torch.float16, 
    trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained("./internlm-xcomposer2d5-7b-reward", trust_remote_code=True)
model.tokenizer = tokenizer

chat_1 = [
    {"role": "user", "content": 'I want to buy a car from the input image, analyze the advantages and weaknesses.'},
    {"role": "assistant", "content": "The car in the image is a Mercedes-Benz G-Class. This is a luxury SUV known for its ruggedness, off-road capability, and iconic boxy design. Here's an analysis of its advantages and weaknesses: Advantages: Off-road capability: The G-Class is built on a robust ladder frame chassis and has a powerful engine, making it highly capable in off-road conditions. It features a low-range transfer case, locking differentials, and a high ground clearance. Luxury and comfort: Despite its rugged exterior, the G-Class offers a luxurious interior with high-quality materials, comfortable seats, and advanced technology features. Iconic design: The distinctive boxy shape of the G-Class has made it a cult classic. It's instantly recognizable and has a timeless appeal. Strong resale value: Due to its exclusivity and desirability, the G-Class tends to hold its value well over time. Weaknesses: Fuel efficiency: The G-Class is not known for its fuel efficiency, especially with the larger engine options. Ride quality: The firm suspension is designed for off-road performance, which can make the ride a bit bumpy on paved roads. Price: The G-Class is a very expensive vehicle, even for a luxury SUV. Size and maneuverability: The large size of the G-Class can make it challenging to park and maneuver in tight spaces."}
]
chat_2 = [
    {"role": "user", "content": 'I want to buy a car from the input image, analyze the advantages and weaknesses.'},
    {"role": "assistant", "content": "Based on the image, it appears to be a Ferrari F8 Tributo. Advantages: Performance: Ferraris are renowned for their exceptional performance. The F8 Tributo is no exception, boasting a powerful twin-turbocharged V8 engine that delivers exhilarating acceleration and top speed. Handling: Ferraris are known for their precise handling and agility. The F8 Tributo continues this tradition, with advanced aerodynamics and sophisticated suspension systems ensuring a thrilling driving experience. Design: Ferrari is synonymous with iconic and head-turning designs. The F8 Tributo is a testament to this, featuring sleek lines, aggressive styling, and a captivating presence. Exclusivity: Owning a Ferrari is a status symbol. It represents luxury, exclusivity, and a passion for high-performance automobiles. Weaknesses: Price: Ferraris come with a hefty price tag. The F8 Tributo is no exception, making it an investment for those with significant financial resources. Fuel Efficiency: High-performance sports cars like the F8 Tributo are not known for their fuel efficiency. You can expect lower miles per gallon compared to everyday vehicles. Maintenance Costs: Owning a Ferrari comes with associated maintenance costs, which can be higher than those for regular cars. Practicality: The F8 Tributo is primarily a two-seater sports car, making it less practical for everyday use or carrying passengers. Ride Comfort: While the F8 Tributo offers a thrilling driving experience, its stiff suspension might not be ideal for long-distance comfort."}
]
image = ['/cache/internlm/internlm-xcomposer2d5-7b-reward/examples/cars1.jpg']
hd_num = 9


# # get reward score for a single chat
# with torch.autocast(device_type='cuda', dtype=torch.float16):
#     score1 = model.get_score(chat_1, image, hd_num=hd_num)
#     score2 = model.get_score(chat_2, image, hd_num=hd_num)
# print("score1: ", score1)
# print("score2: ", score2)
# # >>> score1:  5.76
# # >>> score2:  -2.84375


# batch inference, get multiple scores at once
with torch.autocast(device_type='cuda', dtype=torch.float16):
    scores = model.get_scores([chat_1, chat_2], [image, image], hd_num=hd_num)
print("scores: ", scores)

运行过程中报错:
python intervl_infer.py
/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/utils/generic.py:311: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
torch.utils._pytree._register_pytree_node(
/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/utils/generic.py:311: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
torch.utils._pytree._register_pytree_node(
Set max length to 16384
/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py:1142: FutureWarning: resume_download is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use force_download=True.
warnings.warn(
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cdn-lfs-us-1.hf.co', port=443): Max retries exceeded with url: /repos/74/0b/740b73611f9bb4cb2bf750ef61adee257d59eccbbce837c3a8fa43642f52697f/f2345623c2fe3bd46d9251d7dfdbfc8d55cea5411a1e42940ee15cde730d45c4?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27pytorch_model.bin%3B+filename%3D%22pytorch_model.bin%22%3B&response-content-type=application%2Foctet-stream&Expires=1741711437&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc0MTcxMTQzN319LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmhmLmNvL3JlcG9zLzc0LzBiLzc0MGI3MzYxMWY5YmI0Y2IyYmY3NTBlZjYxYWRlZTI1N2Q1OWVjY2JiY2U4MzdjM2E4ZmE0MzY0MmY1MjY5N2YvZjIzNDU2MjNjMmZlM2JkNDZkOTI1MWQ3ZGZkYmZjOGQ1NWNlYTU0MTFhMWU0Mjk0MGVlMTVjZGU3MzBkNDVjND9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSomcmVzcG9uc2UtY29udGVudC10eXBlPSoifV19&Signature=Wmp0So3mIUjfrf2I92PXBqnoEenUpPTJlsc1yXfJ593JqzB7Gn5Riq2kiu8fFISuyOtR0SmjSEItwPHFoBAxBDNDGR6WkscoIfSn8wAJFQwQFYfUIIwEJJFEEADAD5s1aYPxWuwCfBy1J7P2UzyHNjnFuOaFGMGQ5UORXLzu2KrLBgKFeEicoz9AdRPYfm-Xcs6QJW9IU3ZmtREHCrCWYNNT3nqqkRoKEJDJQP5CIFGixbjoqd34iAWYzOCb-GWIDkMYGnYegm3Ik9MbOMwMIsgPcVRQOKIGMQu5wXuZAQL6kulalPNLzf89atxf8XJPC-2a3IS97hcWr1dJBQ
_&Key-Pair-Id=K24J24Z295AEI9 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/cache/intervl_infer.py", line 10, in
model = AutoModel.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 558, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2966, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2d5-7b-reward/modeling_internlm_xcomposer2.py", line 134, in init
self.vit = build_vision_tower()
^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2d5-7b-reward/build_mlp.py", line 10, in build_vision_tower
return CLIPVisionTower(vision_tower)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2d5-7b-reward/build_mlp.py", line 58, in init
self.load_model()
File "/home/ma-user/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2d5-7b-reward/build_mlp.py", line 61, in load_model
self.vision_tower = CLIPVisionModel.from_pretrained(self.vision_tower_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2805, in from_pretrained
resolved_archive_file = cached_file(
^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/transformers/utils/hub.py", line 429, in cached_file
resolved_file = hf_hub_download(
^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1232, in hf_hub_download
return _hf_hub_download_to_cache_dir(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1381, in _hf_hub_download_to_cache_dir
_download_to_tmp_and_move(
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1915, in _download_to_tmp_and_move
http_get(
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 455, in http_get
r = _request_wrapper(
^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 387, in request_wrapper
response = get_session().request(method=method, url=url, **params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/huggingface_hub/utils/http.py", line 93, in send
return super().send(request, *args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ma-user/anaconda3/envs/cogvlm2plus/lib/python3.11/site-packages/requests/adapters.py", line 698, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: (MaxRetryError("HTTPSConnectionPool(host='cdn-lfs-us-1.hf.co', port=443): Max retries exceeded with url: /repos/74/0b/740b73611f9bb4cb2bf750ef61adee257d59eccbbce837c3a8fa43642f52697f/f2345623c2fe3bd46d9251d7dfdbfc8d55cea5411a1e42940ee15cde730d45c4?response-content-disposition=inline%3B+filename
%3DUTF-8%27%27pytorch_model.bin%3B+filename%3D%22pytorch_model.bin%22%3B&response-content-type=application%2Foctet-stream&Expires=1741711437&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc0MTcxMTQzN319LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmhmLmNvL3JlcG9zLzc0LzBiLzc0MGI3MzYxMWY5YmI0Y2IyYmY3NTBlZjYxYWRlZTI1N2Q1OWVjY2JiY2U4MzdjM2E4ZmE0MzY0MmY1MjY5N2YvZjIzNDU2MjNjMmZlM2JkNDZkOTI1MWQ3ZGZkYmZjOGQ1NWNlYTU0MTFhMWU0Mjk0MGVlMTVjZGU3MzBkNDVjND9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSomcmVzcG9uc2UtY29udGVudC10eXBlPSoifV19&Signature=Wmp0So3mIUjfrf2I92PXBqnoEenUpPTJlsc1yXfJ593JqzB7Gn5Riq2kiu8fFISuyOtR0SmjSEItwPHFoBAxBDNDGR6WkscoIfSn8wAJFQwQFYfUIIwEJJFEEADAD5s1aYPxWuwCfBy1J7P2UzyHNjnFuOaFGMGQ5UORXLzu2KrLBgKFeEicoz9AdRPYfm-Xcs6QJW9IU3ZmtREHCrCWYNNT3nqqkRoKEJDJQP5CIFGixbjoqd34iAWYzOCb-GWIDkMYGnYegm3Ik9MbOMwMIsgPcVRQOKIGMQu5wXuZAQL6kulalPNLzf89atxf8XJPC-2a3IS97hcWr1dJBQ
&Key-Pair-Id=K24J24Z295AEI9 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))"), '

这是huggingface仓库里面的模型权重文件不全吗?期待您的解答

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