Git Product home page Git Product logo

Comments (3)

yilei avatar yilei commented on May 24, 2024

Do you have a full traceback and error message? It should contain the two places where this flag is defined.

I'm not familiar with spyder, does it re-import your modules twice during your debugging process? absl.flags should be handling the "module being re-imported / re-loaded" case here:

if (self.find_module_defining_flag(name) == module_name and
id(module) != self.find_module_id_defining_flag(name)):
# If the flag has already been defined by a module with the same name,
# but a different ID, we can stop here because it indicates that the
# module is simply being imported a subsequent time.
return

from abseil-py.

shankyemcee avatar shankyemcee commented on May 24, 2024

This is the error it produces:

absl.flags._exceptions.DuplicateFlagError: The flag 'workdir' is defined twice. First from c:\users\dell g7 user 2\documents\projects\vision_transformer\vision_transformer\vit_jax\main.py, Second from c:\users\dell g7 user 2\documents\projects\vision_transformer\vision_transformer\vit_jax\main.py. Description from first occurrence: Directory to store logs and model data.

The code that runs:

FLAGS = flags.FLAGS

_WORKDIR = flags.DEFINE_string('workdir', 'workdir','Directory to store logs and model data.')

This is the code that came with the script. It is supposed to be a python module and was not meant to be run iteratively, hence the odd behavior.

from abseil-py.

yilei avatar yilei commented on May 24, 2024

Looks like when you rerun the module in spyder, it will re-execute the module a second time without actually starting a new process.

From absl.flags's perspective, this is really working as intended: it defines the --workdir flag in the global FLAGS object the first time your run the script. Then in the second run, it tries to define the flag again in FLAGS with the same module object.

I think you'll get better answers from spyder users/community.

from abseil-py.

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.