Fujitsu-LLM commited on
Commit
953d63d
·
1 Parent(s): 0fbc2ee

Add gated promp.

Browse files
scripts/README.md.template CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  license: apache-2.0
3
  license_link: LICENSE
4
  language:
 
1
  ---
2
+ extra_gated_prompt: {terms_of_use}
3
  license: apache-2.0
4
  license_link: LICENSE
5
  language:
scripts/generate_documents.py CHANGED
@@ -1,9 +1,10 @@
1
  """Generator for the repositories of Fujitsu-LLM-KG-8x7B models.
2
  """
3
 
4
- from typing import Literal
5
  from dataclasses import dataclass
6
  import re
 
7
 
8
  @dataclass(kw_only=True)
9
  class ModelContent:
@@ -583,7 +584,11 @@ model_contents = [
583
  ]
584
 
585
 
586
- def generate_document(mc: ModelContent, *, kind: Literal["README.md", "LICENSE"]):
 
 
 
 
587
  """Generate REDAME.md or LICENSE.
588
  """
589
  with open(f"./{kind}.template", "r") as f:
@@ -594,15 +599,18 @@ def generate_document(mc: ModelContent, *, kind: Literal["README.md", "LICENSE"]
594
  base_model_id=mc.base_model_id,
595
  train_datasets=re.sub(r'^ {12,12}', '', mc.train_datasets, flags=re.MULTILINE).strip(),
596
  how_to_use=re.sub(r'^ {12,12}', '', mc.how_to_use, flags=re.MULTILINE).strip(),
 
597
  ))
598
  file_path = f"../../{mc.model_name}/{kind}"
599
 
600
  with open(file_path, "w") as f:
601
  f.write(file_text)
602
  print(f"Output to {file_path}")
 
 
603
 
604
 
605
  if __name__ == "__main__":
606
  for mc in model_contents:
607
- generate_document(mc, kind="README.md")
608
- generate_document(mc, kind="LICENSE")
 
1
  """Generator for the repositories of Fujitsu-LLM-KG-8x7B models.
2
  """
3
 
4
+ from typing import Literal, Optional
5
  from dataclasses import dataclass
6
  import re
7
+ import json
8
 
9
  @dataclass(kw_only=True)
10
  class ModelContent:
 
584
  ]
585
 
586
 
587
+ def generate_document(mc: ModelContent,
588
+ *,
589
+ kind: Literal["README.md", "LICENSE"],
590
+ terms_of_use: Optional[str] = None,
591
+ ) -> str:
592
  """Generate REDAME.md or LICENSE.
593
  """
594
  with open(f"./{kind}.template", "r") as f:
 
599
  base_model_id=mc.base_model_id,
600
  train_datasets=re.sub(r'^ {12,12}', '', mc.train_datasets, flags=re.MULTILINE).strip(),
601
  how_to_use=re.sub(r'^ {12,12}', '', mc.how_to_use, flags=re.MULTILINE).strip(),
602
+ terms_of_use=terms_of_use,
603
  ))
604
  file_path = f"../../{mc.model_name}/{kind}"
605
 
606
  with open(file_path, "w") as f:
607
  f.write(file_text)
608
  print(f"Output to {file_path}")
609
+
610
+ return file_text
611
 
612
 
613
  if __name__ == "__main__":
614
  for mc in model_contents:
615
+ terms_of_use = generate_document(mc, kind="LICENSE")
616
+ generate_document(mc, kind="README.md", terms_of_use=json.dumps(terms_of_use))