Welcome to the Builder Academy

Important GAN for world files

More
13 Mar 2024 00:06 - 13 Mar 2024 00:14 #10372 by Cansian
GAN for world files was created by Cansian
Hi guys and gals...

I was bored this week, to I'm trying to build a GAN (Generative Adversial Network) for tbamud.

So for now I'm training a model for generate mobs and a discriminator to identify if the mob generated is valid. The GAN project supports all of lib/world files. I included two encoders: 
  • one that converts all text in a file as a single encoded text. So all mobs in the file 30.mob is stored as a single text, 31.mob on another text. All in the same encoded mob file.
  • The other encoder splits each item at the #. Since the zon files doesn't follows the same pattern, it doesn't work with this encoder.

The code have four parts: 2 kinds of encoder, 1 for loading and training the Gan model and 1 for testing the generator (It can considered a sample code for usage)

The code was written in python. Wanted to code it in C, but will write something to convert the torch tensor to ONNX for use with C when I'm satisfied with the model generator. The script support all types of tbamud world files (mobs, obj, wld, shp, trg, qst), but we have a small sample of qst files actually. But it can work with your on mud.

If you want to try it, it's available at  github.com/Forneck/gan.tbamud

It's included a fake.pt file with generated samples by Google Gemma model for training. Since generating fake samples take a lot of time, it's included.
For the memory usage, it's use DataSets and DataLoader to loads parts of the tensors and reduce the memory load so I can run the training for on my phone when idle. Any suggestions is welcome. I hope you all enjoy. Oh, btw, the code supports saving the trained model locally and on cloud on HuggingFace (needs an auth token - not included)

Since I don't know if it's a Development, Snippet or Building topic (it may include all of these or none at all), I'm posting it here.
Last edit: 13 Mar 2024 00:14 by Cansian. Reason: Just explaining why it's posted at the General section
The following user(s) said Thank You: thomas

Please Log in or Create an account to join the conversation.

More
14 Mar 2024 16:51 #10373 by Cansian
Replied by Cansian on topic GAN for world files
I did a few bugfixes and made a fake text generator, since the provided fake.pt (now gemma.pt) have words outside the vocabulary. Now you can create fake tests using the vocabulary of your mud.

Please Log in or Create an account to join the conversation.

Time to create page: 0.185 seconds