Skip to content

Commit

Permalink
Merge pull request #11 from usnistgov/d
Browse files Browse the repository at this point in the history
Comma not semicolon
  • Loading branch information
knc6 authored Nov 27, 2024
2 parents e26fb72 + efefed4 commit 0a0fce6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
12 changes: 6 additions & 6 deletions atomgpt/examples/inverse_model_multi/id_prop.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JVASP-1151,33.0;2;2;2;2
JVASP-19679,10.0;2;2;2;2
JVASP-816,1.6;2;2;2;2
JVASP-934,10.7;2;2;2;2
JVASP-961,5.4;2;2;2;2
JVASP-1014,7.6;2;2;2;2
JVASP-1151,33.0,2,2,2,2
JVASP-19679,10.0,2,2,2,2
JVASP-816,1.6,2,2,2,2
JVASP-934,10.7,2,2,2,2
JVASP-961,5.4,2,2,2,2
JVASP-1014,7.6,2,2,2,2
21 changes: 17 additions & 4 deletions atomgpt/inverse_models/inverse_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TrainingPropConfig(BaseSettings):
loss_type: str = "default"
optim: str = "adamw_8bit"
lr_scheduler_type: str = "linear"
property_name: str = "prop"
output_dir: str = "outputs"
model_save_path: str = "lora_model_m"
csv_out: str = "AI-AtomGen-prop-dft_3d-test-rmse.csv"
Expand Down Expand Up @@ -265,10 +266,15 @@ def run_atomgpt_inverse(config_file="config.json"):
pprint.pprint(config.dict())
if not os.path.exists(config.output_dir):
os.makedirs(config.output_dir)
if not os.path.exists(config.model_save_path):
os.makedirs(config.model_save_path)
tmp = config.dict()
f = open(os.path.join(config.output_dir, "config.json"), "w")
f.write(json.dumps(tmp, indent=4))
f.close()
f = open(os.path.join(config.model_save_path, "config.json"), "w")
f.write(json.dumps(tmp, indent=4))
f.close()
id_prop_path = config.id_prop_path
run_path = os.path.dirname(id_prop_path)
num_train = config.num_train
Expand All @@ -286,10 +292,17 @@ def run_atomgpt_inverse(config_file="config.json"):
info = {}
info["id"] = i[0]
ids.append(i[0])
if ";" in i[1]:
tmp = "\n".join([str(round(float(j), 2)) for j in i[1].split(";")])
tmp = [float(j) for j in i[1:]]
print("tmp", tmp)
if len(tmp) == 1:
tmp = str(float(tmp[0]))
else:
tmp = str(round(float(i[1]), 3))
tmp = "\n".join(map(str, tmp))

# if ";" in i[1]:
# tmp = "\n".join([str(round(float(j), 2)) for j in i[1].split(";")])
# else:
# tmp = str(round(float(i[1]), 3))
info["prop"] = (
tmp # float(i[1]) # [float(j) for j in i[1:]] # float(i[1]
)
Expand All @@ -313,7 +326,7 @@ def run_atomgpt_inverse(config_file="config.json"):
m_train = make_alpaca_json(
dataset=dat,
jids=train_ids,
prop="prop",
prop=config.property_name,
instruction=config.instruction,
chem_info=config.chem_info,
output_prompt=config.output_prompt,
Expand Down

0 comments on commit 0a0fce6

Please sign in to comment.