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

ConfigFactory.parse_string(conf_text) #16

Open
DanielHuZM opened this issue May 12, 2023 · 1 comment
Open

ConfigFactory.parse_string(conf_text) #16

DanielHuZM opened this issue May 12, 2023 · 1 comment

Comments

@DanielHuZM
Copy link

Hello @hongfz16 , Thanks for your work. It seems wrong when launch the code.

AppearanceDescription = "Iron Man" #@param {type:"string"}

torch.set_default_tensor_type('torch.cuda.FloatTensor')
FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
logging.basicConfig(level=logging.INFO, format=FORMAT)
conf_path = 'confs/examples_small/example.conf'
f = open(conf_path)
conf_text = f.read()
f.close()
conf_text = conf_text.replace('{TOREPLACE}', AppearanceDescription)

print(conf_text)

conf = ConfigFactory.parse_string(conf_text)
print("Prompt: {}".format(conf.get_string('clip.prompt')))
print("Face Prompt: {}".format(conf.get_string('clip.face_prompt')))
print("Back Prompt: {}".format(conf.get_string('clip.back_prompt')))

Shows:

ParseException Traceback (most recent call last)
ParseException: Expected '}', found '=' (at char 1312), (line:67, col:14)

During handling of the above exception, another exception occurred:

ParseSyntaxException Traceback (most recent call last)
in <cell line: 12>()
10 conf_text = conf_text.replace('{TOREPLACE}', AppearanceDescription)
11 # print(conf_text)
---> 12 conf = ConfigFactory.parse_string(conf_text)
13 print("Prompt: {}".format(conf.get_string('clip.prompt')))
14 print("Face Prompt: {}".format(conf.get_string('clip.face_prompt')))

2 frames
/usr/local/lib/python3.10/dist-packages/pyparsing/core.py in parse_string(self, instring, parse_all, parseAll)
1139 else:
1140 # catch and re-raise exception from here, clearing out pyparsing internal stack trace
-> 1141 raise exc.with_traceback(None)
1142 else:
1143 return tokens

ParseSyntaxException: Expected '}', found '=' (at char 1312), (line:67, col:14)

@swanilee
Copy link

swanilee commented Aug 8, 2023

@DanielHuZM I met the same problem, and solved it. That was because of pyhocon version problem.
If you still have that problem, check your pyhocon version -> ( 0.3.57).

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

2 participants