Open hirokinko opened 1 year ago
Did you run make
first? See comment here for info on FROZEN_SYM_BD: https://github.com/facebookresearch/diplomacy_cicero/issues/20. It's by autogenerated code generated by make
.
You shouldn't have to add an google.protobuf.message
import anywhere. I tested and unit tests all pass. Maybe try confirming make runs successfully, and then we can revisit this if it's still an issue?
Here is where the protobuf message for ParlaiFlags is defined: https://github.com/facebookresearch/diplomacy_cicero/blob/main/conf/agents.proto#L692
In theory if everything is working, this should get compiled by make into various definitions in the autogenerated file conf/agents_pb2.py, such as this one that should be near the bottom of that file:
FROZEN_SYM_BD['fairdiplomacy.ParlaiFlags'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiFlags'), 'ParlaiFlags')
FrozenParlaiFlags = FROZEN_SYM_BD['fairdiplomacy.ParlaiFlags']
among a lot of other lines adding entries to FROZEN_SYM_BD
in that same file:
...
FROZEN_SYM_BD['fairdiplomacy.ParlaiNoPressAgent'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiNoPressAgent'), 'ParlaiNoPressAgent')
FrozenParlaiNoPressAgent = FROZEN_SYM_BD['fairdiplomacy.ParlaiNoPressAgent']
FROZEN_SYM_BD['fairdiplomacy.ParlaiNonsenseDetectionEnsemble'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiNonsenseDetectionEnsemble'), 'ParlaiNonsenseDetectionEnsemble')
FrozenParlaiNonsenseDetectionEnsemble = FROZEN_SYM_BD['fairdiplomacy.ParlaiNonsenseDetectionEnsemble']
FROZEN_SYM_BD['fairdiplomacy.NonsenseClassifier'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.NonsenseClassifier'), 'NonsenseClassifier')
FrozenNonsenseClassifier = FROZEN_SYM_BD['fairdiplomacy.NonsenseClassifier']
FROZEN_SYM_BD['fairdiplomacy.ParlaiDiscriminativeNucleusModel'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiDiscriminativeNucleusModel'), 'ParlaiDiscriminativeNucleusModel')
FrozenParlaiDiscriminativeNucleusModel = FROZEN_SYM_BD['fairdiplomacy.ParlaiDiscriminativeNucleusModel']
FROZEN_SYM_BD['fairdiplomacy.ParlaiModel'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiModel'), 'ParlaiModel')
FrozenParlaiModel = FROZEN_SYM_BD['fairdiplomacy.ParlaiModel']
FROZEN_SYM_BD['fairdiplomacy.ParlaiFlags'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ParlaiFlags'), 'ParlaiFlags')
FrozenParlaiFlags = FROZEN_SYM_BD['fairdiplomacy.ParlaiFlags']
FROZEN_SYM_BD['fairdiplomacy.ReproAgent'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.ReproAgent'), 'ReproAgent')
FrozenReproAgent = FROZEN_SYM_BD['fairdiplomacy.ReproAgent']
FROZEN_SYM_BD['fairdiplomacy.BRSearchAgent'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.BRSearchAgent'), 'BRSearchAgent')
FrozenBRSearchAgent = FROZEN_SYM_BD['fairdiplomacy.BRSearchAgent']
FROZEN_SYM_BD['fairdiplomacy.TheBestAgent'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.TheBestAgent'), 'TheBestAgent')
FrozenTheBestAgent = FROZEN_SYM_BD['fairdiplomacy.TheBestAgent']
FROZEN_SYM_BD['fairdiplomacy.BQRE1PAgent'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.BQRE1PAgent'), 'BQRE1PAgent')
FrozenBQRE1PAgent = FROZEN_SYM_BD['fairdiplomacy.BQRE1PAgent']
FROZEN_SYM_BD['fairdiplomacy.BQRE1PAgent.PlayerTypes'] = create_frozen_class(_sym_db.GetSymbol('fairdiplomacy.BQRE1PAgent.PlayerTypes'), 'BQRE1PAgent.PlayerTypes')
FrozenBQRE1PAgent.PlayerTypes = FROZEN_SYM_BD['fairdiplomacy.BQRE1PAgent.PlayerTypes']
...
I ran the unit test and found two problems with the code generated from protos.
KeyError: 'fairdiplomacy.ParlaiFlags'
in unit_tests/test_bqre1p_lambdas.pyI can solve the first problem to apply the patch to the generation code, but the second problem seems to be in the code added in "heyhi/bin/patch_protos.py"; I've not solved this yet. Has anyone been able to solve this problem?
The following is the result of running the unit test.