Skip to content

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #18

@tankailong

Description

@tankailong

After a long time, I finally installed the program, but when I ran the test data, I found that this error returned me, can someone help me check the problem? I'm using a 4070 graphics card

`(word) F:\python\Word-As-Image>python code/main.py  --semantic_concept "LEAVES" --word "NATURE" --optimized_letter "T" --font "HobeauxRococeaux-Sherman" --seed 0
D:\ProgramData\anaconda3\envs\word\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: '[WinError 127] 找不到指定的程序。'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
  warn(
Config: {'parent_config': 'baseline', 'save': {'init': True, 'image': True, 'video': True, 'video_frame_freq': 1}, 'trainable': {'point': True}, 'lr_base': {'point': 1}, 'lr': {'lr_init': 0.002, 'lr_final': 0.0008, 'lr_delay_mult': 0.1, 'lr_delay_steps': 100}, 'num_iter': 500, 'render_size': 600, 'cut_size': 512, 'level_of_cc': 1, 'seed': 0, 'diffusion': {'model': 'runwayml/stable-diffusion-v1-5', 'timesteps': 1000, 'guidance_scale': 100}, 'loss': {'use_sds_loss': True, 'tone': {'use_tone_loss': True, 'dist_loss_weight': 100, 'pixel_dist_kernel_blur': 201, 'pixel_dist_sigma': 30}, 'conformal': {'use_conformal_loss': True, 'angeles_w': 0.5}}, 'config': 'code/config/base.yaml', 'experiment': 'conformal_0.5_dist_pixel_100_kernel201', 'font': 'HobeauxRococeaux-Sherman', 'semantic_concept': 'LEAVES', 'word': 'NATURE', 'caption': 'a LEAVES. minimal flat 2d vector. lineal color. trending on artstation', 'log_dir': 'output/conformal_0.5_dist_pixel_100_kernel201_NATURE', 'optimized_letter': 'T', 'batch_size': 1, 'token': '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', 'use_wandb': 0, 'wandb_user': 'none', 'letter': 'HobeauxRococeaux-Sherman_T_scaled', 'target': 'code/data/init/HobeauxRococeaux-Sherman_T_scaled', 'experiment_dir': 'output/conformal_0.5_dist_pixel_100_kernel201_NATURE\\HobeauxRococeaux-Sherman\\HobeauxRococeaux-Sherman_T_scaled_concept_LEAVES_seed_0'}
preprocessing
======= HobeauxRococeaux-Sherman =======
94
196
155
124
121
152
==== N ====
TOTAL CP:   [195]
195
code/data/fonts/HobeauxRococeaux-Sherman.ttf N
==== A ====
TOTAL CP:   [153]
153
code/data/fonts/HobeauxRococeaux-Sherman.ttf A
==== T ====
TOTAL CP:   [123]
123
code/data/fonts/HobeauxRococeaux-Sherman.ttf T
==== U ====
TOTAL CP:   [120]
120
code/data/fonts/HobeauxRococeaux-Sherman.ttf U
==== R ====
TOTAL CP:   [150]
150
code/data/fonts/HobeauxRococeaux-Sherman.ttf R
==== E ====
TOTAL CP:   [129]
129
code/data/fonts/HobeauxRococeaux-Sherman.ttf E
Done preprocess
Fetching 27 files: 100%|███████████████████████████████████████████████████████████████████████| 27/27 [00:00<?, ?it/s]
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["id2label"]` will be overriden.
initializing shape
saving init
T tensor(0) tensor(0)
Traceback (most recent call last):
  File "code/main.py", line 95, in <module>
    conformal_loss = ConformalLoss(parameters, device, cfg.optimized_letter, shape_groups)
  File "F:\python\Word-As-Image\code\losses.py", line 124, in __init__
    self.reset()
  File "F:\python\Word-As-Image\code\losses.py", line 149, in reset
    self.angles = self.get_angles(points)
  File "F:\python\Word-As-Image\code\losses.py", line 130, in get_angles
    triangles = points[self.faces[i]]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions