[GH-ISSUE #83] macOS 15.1.1 (24B91),M3 chip , 使用1B模型时(通过 app_januspro.py),图片对话正常,但生成图片报错 RuntimeError: Input type (c10::BFloat16) and bias type (c10::Half) should be the same, #63

Open
opened 2026-10-26 21:11:21 +00:00 by bsakaguchi · 5 comments
Owner

Originally created by @craii on GitHub (Jan 29, 2025).
Original GitHub issue: https://github.com/deepseek-ai/Janus/issues/83

raceback (most recent call last):
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/blocks.py", line 1935, in process_api
result = await self.call_function(
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/blocks.py", line 1520, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2364, in run_sync_in_worker_thread
return await future
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 864, in run
result = context.run(func, *args)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/utils.py", line 826, in wrapper
response = f(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "./demo/app_januspro.py", line 160, in generate_image
output, patches = generate(input_ids,
File "./demo/app_januspro.py", line 118, in generate
patches = vl_gpt.gen_vision_model.decode_code(generated_tokens.to(dtype=torch.int),
File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 507, in decode_code
dec = self.decode(quant_b)
File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 502, in decode
dec = self.decoder(quant)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 208, in forward
h = block.upsample(h)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 426, in forward
x = self.conv(x)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 458, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 454, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (c10::BFloat16) and bias type (c10::Half) should be the same

Originally created by @craii on GitHub (Jan 29, 2025). Original GitHub issue: https://github.com/deepseek-ai/Janus/issues/83 raceback (most recent call last): File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/queueing.py", line 536, in process_events response = await route_utils.call_process_api( File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/route_utils.py", line 322, in call_process_api output = await app.get_blocks().process_api( File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/blocks.py", line 1935, in process_api result = await self.call_function( File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/blocks.py", line 1520, in call_function prediction = await anyio.to_thread.run_sync( # type: ignore File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2364, in run_sync_in_worker_thread return await future File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 864, in run result = context.run(func, *args) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/gradio/utils.py", line 826, in wrapper response = f(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "./demo/app_januspro.py", line 160, in generate_image output, patches = generate(input_ids, File "./demo/app_januspro.py", line 118, in generate patches = vl_gpt.gen_vision_model.decode_code(generated_tokens.to(dtype=torch.int), File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 507, in decode_code dec = self.decode(quant_b) File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 502, in decode dec = self.decoder(quant) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 208, in forward h = block.upsample(h) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/janus/models/vq_model.py", line 426, in forward x = self.conv(x) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 458, in forward return self._conv_forward(input, self.weight, self.bias) File "/Users/eliascheung/Documents/Janus/WORKENV/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 454, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: Input type (c10::BFloat16) and bias type (c10::Half) should be the same
Author
Owner

@Hxxxz0 commented on GitHub (Jan 29, 2025):

我也遇到了同样的问题 mac 无法运行生成的这个程序

<!-- gh-comment-id:2621138074 --> @Hxxxz0 commented on GitHub (Jan 29, 2025): 我也遇到了同样的问题 mac 无法运行生成的这个程序
Author
Owner

@craii commented on GitHub (Jan 29, 2025):

我也遇到了同样的问题 mac 无法运行生成的这个程序

thanks to @takahirosir 's work repled on https://github.com/deepseek-ai/Janus/issues/66#issuecomment-2619865019

github.com/takahirosir/Janus@ff1e732981 (diff-1b6c4cb198)

it works for me but makes the inference way more slower than generating image of the same size with comfyui on my macbook

<!-- gh-comment-id:2621367529 --> @craii commented on GitHub (Jan 29, 2025): > 我也遇到了同样的问题 mac 无法运行生成的这个程序 thanks to [@takahirosir](https://github.com/takahirosir) 's work repled on https://github.com/deepseek-ai/Janus/issues/66#issuecomment-2619865019 https://github.com/takahirosir/Janus/commit/ff1e732981695b08c35f7356e04c89bb925906bf#diff-1b6c4cb1987bfffe1eba923c8b618df435472bfa1544712d10e491cd3b852c93 it works for me but makes the inference way more slower than generating image of the same size with comfyui on my macbook
Author
Owner

@craii commented on GitHub (Jan 29, 2025):

please fix this

<!-- gh-comment-id:2621369091 --> @craii commented on GitHub (Jan 29, 2025): please fix this
Author
Owner

@jerryzhao173985 commented on GitHub (Jan 31, 2025):

same for me

<!-- gh-comment-id:2628083005 --> @jerryzhao173985 commented on GitHub (Jan 31, 2025): same for me
Author
Owner

@kipa200 commented on GitHub (Feb 1, 2025):

RuntimeError: probability tensor contains either inf, nan or element < 0

up is my error

<!-- gh-comment-id:2628829316 --> @kipa200 commented on GitHub (Feb 1, 2025): RuntimeError: probability tensor contains either `inf`, `nan` or element < 0 up is my error
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/Janus#63
No description provided.