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

[BUG] ... KeyError: 'in_ch' RMBG-1.4 #607

Closed
f-amerehi opened this issue Mar 14, 2024 · 2 comments
Closed

[BUG] ... KeyError: 'in_ch' RMBG-1.4 #607

f-amerehi opened this issue Mar 14, 2024 · 2 comments
Labels
bug Something isn't working stale

Comments

@f-amerehi
Copy link

Describe the bug

Following the usage from HF. When loading the model via net = BriaRMBG.from_pretrained("briaai/RMBG-1.4") it returns a KeyError for 'in_ch' despite the key is available.

from skimage import io
import torch
from PIL import Image
from briarmbg import BriaRMBG
from utilities import preprocess_image, postprocess_image
import matplotlib.pyplot as plt



net = BriaRMBG.from_pretrained("briaai/RMBG-1.4")

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net.to(device)

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-6-08fbcf1bcc4f>](https://localhost:8080/#) in <cell line: 1>()
----> 1 net = BriaRMBG.from_pretrained("briaai/RMBG-1.4")
      2 
      3 device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
      4 net.to(device)

3 frames
[/content/RMBG-1.4/briarmbg.py](https://localhost:8080/#) in __init__(self, config)
    350     def __init__(self,config:dict={"in_ch":3,"out_ch":1}):
    351         super(BriaRMBG,self).__init__()
--> 352         in_ch=config["in_ch"]
    353         out_ch=config["out_ch"]
    354         self.conv_in = nn.Conv2d(in_ch,64,3,stride=2,padding=1)

KeyError: 'in_ch'

But the dictionary has the key of 3. How to fix the error?
image

Thanks!

@f-amerehi f-amerehi added the bug Something isn't working label Mar 14, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Apr 14, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

1 participant