Giter Site home page Giter Site logo

Comments (11)

Anaphory avatar Anaphory commented on September 6, 2024

Also:

Traceback (most recent call last):
  File "/home/gereon/Develop/BEASTling/beastling/cli.py", line 136, in do_generate
    xml = BeastXml(config)
  File "/home/gereon/Develop/BEASTling/beastling/beastxml.py", line 65, in __init__
    self.build_xml()
  File "/home/gereon/Develop/BEASTling/beastling/beastxml.py", line 97, in build_xml
    self.add_run()
  File "/home/gereon/Develop/BEASTling/beastling/beastxml.py", line 163, in add_run
    self.add_operators()
  File "/home/gereon/Develop/BEASTling/beastling/beastxml.py", line 358, in add_operators
    model.add_operators(self.run)
  File "/home/gereon/Develop/BEASTling/beastling/models/binary.py", line 249, in add_operators
    BaseModel.add_operators(self, run)
  File "/home/gereon/Develop/BEASTling/beastling/models/basemodel.py", line 683, in add_operators
    self.add_frequency_operators(run)
  File "/home/gereon/Develop/BEASTling/beastling/models/binary.py", line 260, in add_frequency_operators
    for name in self.parameter_identifiers():
AttributeError: 'BinaryModel' object has no attribute 'parameter_identifiers'

from beastling.

lmaurits avatar lmaurits commented on September 6, 2024

Hmm, it's the base class for the Covarion model, right? I use that regularly and have not encountered any problems. But maybe I'm just not exercising it in the right way...

from beastling.

Anaphory avatar Anaphory commented on September 6, 2024

There's also a binary model in its own right, I just tried to run a binary non-covarion model and got this.

from beastling.

lmaurits avatar lmaurits commented on September 6, 2024

The CTMC model? That's another subclass of this, though, right?

from beastling.

Anaphory avatar Anaphory commented on September 6, 2024

Hum. That is very strange indeed. I just typed binary, not binaryctmc.

According to https://github.com/lmaurits/BEASTling/blob/master/beastling/configuration.py#L739-L765, I would expect that to throw a ValueError("Unknown model type 'binary' for model section 'vocabulary', and failed to import a third-party model.")

That means, I need to have a closer look on what exactly is going on under the hood. I hate rabbit holes.

from beastling.

xrotwang avatar xrotwang commented on September 6, 2024

Maybe there's a file binary.py in your cwd? See

else:
try:
sys.path.insert(0, os.getcwd())
module_path, class_name = config["model"].rsplit(".",1)
module = importlib.import_module(module_path)
UserClass = getattr(module, class_name)
except:
raise ValueError("Unknown model type '%s' for model section '%s', and failed to import a third-party model." % (config["model"], config["name"]))
model = UserClass(config, self)

from beastling.

Anaphory avatar Anaphory commented on September 6, 2024

I expect config["model"] == 'binary', so config["model"].rsplit(".",1) == ['binary'], so ValueError: not enough values to unpack (expected 2, got 1) to be caught and replaced by ValueError("Unknown model type 'binary' for model section 'vocabulary', and failed to import a third-party model.")

(That bare except is not nice, though.)

from beastling.

xrotwang avatar xrotwang commented on September 6, 2024

Ah, ok. I see. Looks like you are in for a couple of prints.

from beastling.

lmaurits avatar lmaurits commented on September 6, 2024

Yep, that should probably just be except ImportError. Maybe the else at 755 should be elif config["model"].endswith(".py") if that's how we want to signal an attempt to use an external model?

from beastling.

Anaphory avatar Anaphory commented on September 6, 2024

As I read it, the code we have looks reasonable, and the errors I expect are ValueError (like in my case) and ImportError (mistyped some module name). No need to have a '.py' in the string.

It's probably something dumb on my end. I'll drop some breakpoint()s and print()s this evening.

from beastling.

lmaurits avatar lmaurits commented on September 6, 2024

Argh, sorry, you're right, I quickly misread that split as operating on a filename to remove the extension, not separating a module and class.

from beastling.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.