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

Question about weights #71

Open
mah-asd opened this issue Aug 16, 2023 · 0 comments
Open

Question about weights #71

mah-asd opened this issue Aug 16, 2023 · 0 comments

Comments

@mah-asd
Copy link

mah-asd commented Aug 16, 2023

Hello, Thanks for your great job sharing with us, could you please help me with getting access to the model weights during the training?

I see in rendering there is weight but it's empty as the function returns [] as weights:

rgb_map, alphas_map, depth_map, weights, uncertainty = renderer(rays_train, tensorf, chunk=args.batch_size,
N_samples=nSamples, white_bg = white_bg, ndc_ray=ndc_ray, device=device, is_train=True)

I figured out with this function:

def get_param(tensorf, logfolder, expname, model_name):
tensorf.save(f'{logfolder}/{expname}.th')
ckpt = torch.load(f'{logfolder}/{expname}.th', map_location=device)
param = []
for key in ckpt['state_dict'].keys():
param.append(ckpt['state_dict'][str(key)].reshape(-1).clone().detach())
params = torch.cat(param)
return params

Although it's writing the model, then loading it, then concatenate all the matrices, am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant