Skip to content

'DirectLauncher' object has no attribute 'add_token' #165

@VictorMorand

Description

@VictorMorand

I have touble setting up a launcher on MacOS using tokens
After doing :

──────────────────────────────────────────────────────────────────╮
│ Direct Launcher Configuration                                    │
│                                                                  │
│ This wizard configures resource tokens for local task execution. │
│ Tokens ensure tasks don't exceed available memory.               │
╰──────────────────────────────────────────────────────────────────╯

Detecting system resources...

                       System Resources                        
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Resource  ┃ Value                                           ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Total RAM │ 16.0 GiB                                        │
│ CPU cores │ 10                                              │
│ GPU 0     │ Apple MPS (unified memory) (16.0 GiB (unified)) │
│ Platform  │ Apple Silicon (MPS)                             │
└───────────┴─────────────────────────────────────────────────┘

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Memory Tokens                                                                                                                                                                            │
│                                                                                                                                                                                          │
│ Memory tokens prevent over-committing system RAM.                                                                                                                                        │
│ Each token represents a unit of memory (default: 256 MiB).                                                                                                                               │
│ Tasks request tokens based on their memory needs.                                                                                                                                        │
│                                                                                                                                                                                          │
│ Example: 1 GiB requirement = 4 tokens (with 256 MiB unit)                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Enable memory tokens? [y/n] (y): y
  Reserved memory for OS (GiB) (2.0): 
  Token unit size (MiB) (256): 
  → 56 memory tokens available

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ GPU Tokens                                                                                                                                                                               │
│                                                                                                                                                                                          │
│ GPU tokens control concurrent GPU task execution.                                                                                                                                        │
│                                                                                                                                                                                          │
│ Exclusive mode: 1 token = 1 GPU (simple, recommended)                                                                                                                                    │
│ Memory mode: Tokens based on GPU memory units                                                                                                                                            │
│                                                                                                                                                                                          │
│ Note: Apple MPS uses unified memory - GPU memory                                                                                                                                         │
│ requests will reduce available CPU memory tokens.                                                                                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Enable GPU tokens? [y/n] (y): y
  MPS detected: using memory-based tokens (shared with CPU memory)
  GPU token unit size (MiB) (1024): 2048
  → MPS: GPU tasks will use memory tokens

                       Configuration Summary                        
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Setting       ┃ Value                                            ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Output file   │ /Users/victor/.config/experimaestro/launchers.py │
│ Memory tokens │ 56 (256 MiB each)                                │
│ GPU tokens    │ Using memory tokens (MPS)                        │
└───────────────┴──────────────────────────────────────────────────┘

Generate configuration? [y/n] (y): y

✓ Generated /Users/victor/.config/experimaestro/launchers.py
✓ Generated /Users/victor/.config/experimaestro/tokens.yaml

Done! Your launcher configuration is ready.
Traceback (most recent call last):
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/bin/experimaestro", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/__main__.py", line 8, in main
    cli(obj=None)
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/lib/python3.12/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/lib/python3.12/site-packages/click/core.py", line 1406, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/lib/python3.12/site-packages/click/core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/lib/python3.12/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/.venv/lib/python3.12/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/experiments/cli.py", line 667, in experiments_cli
    run_experiment_code()
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/experiments/cli.py", line 522, in run_experiment_code
    helper.run(list(args), xp_configuration)
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/experiments/cli.py", line 45, in run
    self.callable(self, configuration)
  File "/Users/victor/code/projects/sota-cross-encoders/src/ir_training/experiment.py", line 117, in run
    launcher_index = find_launcher(cfg.indexation.requirements)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/launcherfinder/registry.py", line 177, in find_launcher
    launcher = LauncherRegistry.instance().find(*specs, tags=tags)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/code/projects/sota-cross-encoders/experimaestro-python/src/experimaestro/launcherfinder/registry.py", line 164, in find
    if launcher := self.find_launcher_fn(spec, tags):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/victor/.config/experimaestro/launchers.py", line 89, in find_launcher
    launcher.add_token(registry.getToken("memory"), memory_tokens)
    ^^^^^^^^^^^^^^^^^^
AttributeError: 'DirectLauncher' object has no attribute 'add_token'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions