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

Support "Human-Like" model #708

Open
TristanCacqueray opened this issue Aug 18, 2024 · 2 comments
Open

Support "Human-Like" model #708

TristanCacqueray opened this issue Aug 18, 2024 · 2 comments

Comments

@TristanCacqueray
Copy link

We need to pass a new -human-model parameter after the KataGo command, and it looks like such wrapper script works:

#!/bin/sh
command=$(echo $1)
shift
exec /nix/store/g398d059f5g8s7i6k5grrx7zl21cf4pk-katago-1.15.3/bin/katago $command -human-model /nix/store/6dhgn7sxxvy78s9bd50kzazz3n1dxhfm-b18c384nbt-humanv0.bin.gz $*

Is there any plan to support this natively in katrain?

Thanks for the tool by the way!

@simonguoxm
Copy link

For me, it is not necessary to support this.

@pdeblanc
Copy link
Contributor

I've gotten this working locally. Here's what I did:

  • Download the b18c384nbt-humanv0.bin.gz model into my ~/.katrain directory
  • Create a copy of katrain/KataGo/analysis_config.cfg called katrain/KataGo/humanlike_config.cfg
  • In humanlike_config.cfg, append the line humanSLProfile = preaz_2d (i.e. emulating 2-dan human play from the old days; other settings are possible)
  • In katrain/core/engine.py, around line 120, add the following lines:
             cfg = find_package_resource(config["config"])
+            if "human" in model:
+                cfg = cfg.replace("analysis", "humanlike")
             exe = self.get_engine_path(config.get("katago", "").strip())

It is necessary to have two separate configs, because the default KataGo models will raise an error if the humanSLProfile setting is present in the config.

I could consider putting up a PR, but I'm not sure if this solution is sufficiently user-friendly:

  • You have to switch the model in the General/Engine settings to get humanlike play (e.g. with the Policy Weighted AI)
  • This will also use the human policy for analysis; there's no convenient way to use the human policy for play while simultaneously using the AI policy for analysis
  • There should probably be a way to change the humanSLProfile via a menu instead of editing the config. This could include the following options and suboptions:
    • Modern amateur style
      • select rank
    • Pre-AI amateur style
      • select rank
      • select opponent rank (e.g. to see how a human 4d might play against a 10k opponent)
    • Professional style
      • select year (1800 to 2023)

For reference, the humanSLProfile options are documented here: https://github.com/lightvector/KataGo/blob/master/docs/Analysis_Engine.md

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

3 participants