mirror of
https://github.com/deepseek-ai/Janus.git
synced 2026-11-05 00:57:18 +00:00
[GH-ISSUE #126] output image resolution details issues #95
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/Janus#95
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bjohn22 on GitHub (Feb 2, 2025).
Original GitHub issue: https://github.com/deepseek-ai/Janus/issues/126
Any thoughts on why I am not able to reproduce the same resolution reported out there:
Weights: I downloaded weights from Huggingface to local and loaded it from local directory
Model:
Janus-Pro-7BPrompt
python "/home/mytemp/Documents/ml_projects/Janus/janus_run_script.py" generate --prompt "Elephant on Dallas Texas street" --seed 142 --guidance 5.0Here is my text to image snippet:
def generate(input_ids,
width,
height,
temperature: float = 1,
parallel_size: int = 16,
cfg_weight: float = 5,
image_token_num_per_image: int = 576,
patch_size: int = 16):
"""
Internal method that generates image patches from the text input.
"""
torch.cuda.empty_cache()
tokens = torch.zeros((parallel_size * 2, len(input_ids)), dtype=torch.int).to(cuda_device)
def unpack(dec, width, height, parallel_size=16):
"""
Convert raw patches into final numpy images.
"""
dec = dec.to(torch.float32).cpu().numpy().transpose(0, 2, 3, 1)
dec = np.clip((dec + 1) / 2 * 255, 0, 255)
@torch.inference_mode()
def generate_image(prompt, seed, guidance):
"""
Generate multiple images for a given prompt.
"""
torch.cuda.empty_cache()
seed = seed if seed is not None else 12345
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
np.random.seed(seed)
@bjohn22 commented on GitHub (Feb 2, 2025):
Here are my files list
@ukaprc commented on GitHub (Feb 6, 2025):
Your image is 1024 X 1024 which is larger than the usual 768 X 768. The process uses the Image.LANCZOS method to resize from 384 X 384. Did you change the resize size? Even if you did, this method isn't as effective as using a real upscaler (as they've done in their online demo) such as RealESRGAN. You can easily enough integrate the upscaler into your inference code.
@zohebnsr commented on GitHub (Mar 1, 2025):
The model can't make more than 384 pixel originally? right?
@ukaprch commented on GitHub (Mar 3, 2025):
zohebnsr
The model is fixed at 384 and then resizes, but you can upscale vs resizing for a better image.