- 
                Notifications
    You must be signed in to change notification settings 
- Fork 7.8k
Fix Windows crash: panoptic_fpn.py passing int32 instead of long #5455
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
          
     Open
      
      
            dzenanz
  wants to merge
  2
  commits into
  facebookresearch:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
dzenanz:longInsteadOfInt32
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +2
        
        
          −1
        
        
          
        
      
    
  
Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    Stack trace:
[04/02 13:07:05 d2.data.build]: Distribution of instances among all 4 categories:
|  category  | #instances   |  category  | #instances   |  category  | #instances   |
|:----------:|:-------------|:----------:|:-------------|:----------:|:-------------|
|     G      | 25           |     SG     | 8            |     T      | 746          |
|     A      | 58           |            |              |            |              |
|   total    | 837          |            |              |            |              |
[04/02 13:07:05 d2.data.common]: Serializing the dataset using: <class 'detectron2.data.common._TorchSerializedList'>
[04/02 13:07:05 d2.data.common]: Serializing 40 elements to byte tensors and concatenating them all ...
[04/02 13:07:05 d2.data.common]: Serialized dataset takes 8.95 MiB
check and see
[04/02 13:07:05 d2.checkpoint.detection_checkpoint]: [DetectionCheckpointer] Loading from M:/Histo/Work/model_0214999.pth ...
[04/02 13:07:05 d2.engine.train_loop]: Starting training from iteration 0
ERROR [04/02 13:07:42 d2.engine.train_loop]: Exception during training:
Traceback (most recent call last):
  File "M:\Histo\.venv38\lib\site-packages\detectron2\engine\train_loop.py", line 155, in train
    self.run_step()
  File "M:\Histo\.venv38\lib\site-packages\detectron2\engine\defaults.py", line 530, in run_step
    self._trainer.run_step()
  File "M:\Histo\.venv38\lib\site-packages\detectron2\engine\train_loop.py", line 310, in run_step
    loss_dict = self.model(data)
  File "M:\Histo\.venv38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "M:\Histo\.venv38\lib\site-packages\detectron2\modeling\meta_arch\panoptic_fpn.py", line 127, in forward
    sem_seg_results, sem_seg_losses = self.sem_seg_head(features, gt_sem_seg)
  File "M:\Histo\.venv38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "M:\Histo\.venv38\lib\site-packages\detectron2\modeling\meta_arch\semantic_seg.py", line 239, in forward
    return None, self.losses(x, targets)
  File "M:\Histo\.venv38\lib\site-packages\detectron2\modeling\meta_arch\semantic_seg.py", line 263, in losses
    loss = F.cross_entropy(
  File "M:\Histo\.venv38\lib\site-packages\torch\nn\functional.py", line 2846, in cross_entropy
    return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: expected scalar type Long but found Int
    Addressing: (.venv38) M:\Histo\detectron2>bash dzenan@Ryzenator:/mnt/m/Histo/detectron2$ dev/linter.sh dev/linter.sh: line 3: $'\r': command not found
| This affects both version 0.6 and current main branch. I tried it with torch 1.10.1 with CUDA 11.3, as well as torch 2.6.0 with CUDA 12.4. | 
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      Apr 2, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      Apr 3, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      Apr 3, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      May 29, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      May 30, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
    
  dzenanz 
      added a commit
        to dzenanz/Multi-Compartment-Segmentation
      that referenced
      this pull request
    
      Jun 27, 2025 
    
    
      
  
    
      
    
  
They were invalid. The problem was in detectron2, fixed by: facebookresearch/detectron2#5455 With this fix, both the old and versions of libraries work.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    CLA Signed
  This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Stack trace:
dev/linter.shonly makes unrelated changes.