pgn to polyglot

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
flok
Posts: 582
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

pgn to polyglot

Post by flok »

Hello,

I've got a 350 GB pgn file that I'd like to convert to a polyglot-book.
My laptop has 64 GB ram but for the polyglot-program (the original) that is not enough to do so.
Does anyone know a program (open source so that I can run it on Linux) that can handle such large files? Preferably read from a pipe so that I don't have to decompress it first (polyglot can do so).


regards
jefk
Posts: 1024
Joined: Sun Jul 25, 2010 10:07 pm
Location: the Netherlands
Full name: Jef Kaan

Re: pgn to polyglot

Post by jefk »

User avatar
flok
Posts: 582
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: pgn to polyglot

Post by flok »

I looked at polyglot-tolerant and it looks like to be polyglot with a few tweaks but not for memory management.
User avatar
Jim Ablett
Posts: 2273
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: pgn to polyglot

Post by Jim Ablett »

You could try Windows program PGN Book Creator. (may work with Wine)

I haven't tested with very large pgns.

Download my version with doesn't trigger antivirus. Original uses Python script converted to executable which will normally trigger antiviruses but mine is compressed with warp packer which doesn't trigger alerts.

https://drive.proton.me/urls/6WSYHGE5A8#406s0ye6GJ0z

Jim.
Dann Corbit
Posts: 12791
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: pgn to polyglot

Post by Dann Corbit »

JJA converts every imaginable book format
https://crates.io/crates/jja
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
pohl4711
Posts: 2802
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Re: pgn to polyglot

Post by pohl4711 »

I have an old tool on my googledrive, which allows to convert Arena books into polyglot books (abk2bin is the name)
So, if you manage to build your book in Arena, it should be easy convertable into polyglot, using this tool.

User avatar
Rebel
Posts: 7381
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: pgn to polyglot

Post by Rebel »

Assuming you use polyglot from Fabien L, split the PGN into x parts your memory can handle, then merge them together.

But you need the 64 bit version of Polyglot because of the 2Gb filesize limit of a 32 bit application.
90% of coding is debugging, the other 10% is writing bugs.
User avatar
flok
Posts: 582
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: pgn to polyglot

Post by flok »

Rebel wrote: Fri Sep 19, 2025 4:40 pm Assuming you use polyglot from Fabien L, split the PGN into x parts your memory can handle, then merge them together.

But you need the 64 bit version of Polyglot because of the 2Gb filesize limit of a 32 bit application.
But won't that affect the weights-variable incorrectly? I'm going to dig through polyglot I to see how it handles the merges.

[...]

Code: Select all

               for(j=0; j<n; j++) {
                  if(e[i].move == e[j].move) {
                     e[j].count += e[i--].count;
                     break;
                  }
               }
That is what I was afraid off: counts are just added with no overflow check or anything.
With large sets this will fail.
So I wrote something that handles this and can merge more than 2 files in one go. I'll publish it tomorrow.
User avatar
Rebel
Posts: 7381
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: pgn to polyglot

Post by Rebel »

flok wrote: Fri Sep 19, 2025 7:19 pm
Rebel wrote: Fri Sep 19, 2025 4:40 pm Assuming you use polyglot from Fabien L, split the PGN into x parts your memory can handle, then merge them together.

But you need the 64 bit version of Polyglot because of the 2Gb filesize limit of a 32 bit application.
But won't that affect the weights-variable incorrectly? I'm going to dig through polyglot I to see how it handles the merges.

[...]

Code: Select all

               for(j=0; j<n; j++) {
                  if(e[i].move == e[j].move) {
                     e[j].count += e[i--].count;
                     break;
                  }
               }
That is what I was afraid off: counts are just added with no overflow check or anything.
With large sets this will fail.
So I wrote something that handles this and can merge more than 2 files in one go. I'll publish it tomorrow.
Polyglot itself has a --merge function.
90% of coding is debugging, the other 10% is writing bugs.
User avatar
flok
Posts: 582
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: pgn to polyglot

Post by flok »

Rebel wrote: Fri Sep 19, 2025 10:54 pm
flok wrote: Fri Sep 19, 2025 7:19 pm
Rebel wrote: Fri Sep 19, 2025 4:40 pm Assuming you use polyglot from Fabien L, split the PGN into x parts your memory can handle, then merge them together.

But you need the 64 bit version of Polyglot because of the 2Gb filesize limit of a 32 bit application.
But won't that affect the weights-variable incorrectly? I'm going to dig through polyglot I to see how it handles the merges.

[...]

Code: Select all

               for(j=0; j<n; j++) {
                  if(e[i].move == e[j].move) {
                     e[j].count += e[i--].count;
                     break;
                  }
               }
That is what I was afraid off: counts are just added with no overflow check or anything.
With large sets this will fail.
So I wrote something that handles this and can merge more than 2 files in one go. I'll publish it tomorrow.
Polyglot itself has a --merge function.
That broken code *is* from polyglot.