benjaminrose / SN-with-Roman-Prism

Characterizing SN Observations with the Roman ST Prism
0 stars 0 forks source link

Be able to run `embed2spec` outside `embed2spec` directory. #2

Closed benjaminrose closed 3 years ago

benjaminrose commented 3 years ago

When running outside of embed2spec the path handling is incorrect.

  File "embed2roman.py", line 22, in build_lc
    model = sncosmo.Model(source=TwinsEmbedding())
  File "/Users/benrose/Documents/1 Projects/SN-with-Roman-Prism/embed2spec/source.py", line 64, in __init__
    self.model = load_model()
  File "/Users/benrose/Documents/1 Projects/SN-with-Roman-Prism/embed2spec/source.py", line 56, in load_model
    net.load_state_dict(torch.load('trained_model.pt'))
  File "/Users/benrose/miniconda3/envs/embed2spec/lib/python3.8/site-packages/torch/serialization.py", line 571, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/Users/benrose/miniconda3/envs/embed2spec/lib/python3.8/site-packages/torch/serialization.py", line 229, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/Users/benrose/miniconda3/envs/embed2spec/lib/python3.8/site-packages/torch/serialization.py", line 210, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'trained_model.pt'

Need an update to embed2spec.

benjaminrose commented 3 years ago

On hold till Thursday, November 12th when @sam-dixon can look at this.