Tijmen2 commited on
Commit
05d984a
1 Parent(s): 2f7faaa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -5
README.md CHANGED
@@ -1,13 +1,57 @@
1
  ---
2
  tags:
3
- - generated_from_trainer
 
4
  model-index:
5
- - name: workspace/output/cosmosage_qa
6
  results: []
 
 
 
 
 
7
  ---
8
 
9
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
10
- should probably proofread and complete it, then remove this comment. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
13
  <details><summary>See axolotl config</summary>
@@ -178,4 +222,4 @@ The following hyperparameters were used during training:
178
  - Transformers 4.38.0.dev0
179
  - Pytorch 2.0.1+cu118
180
  - Datasets 2.17.0
181
- - Tokenizers 0.15.0
 
1
  ---
2
  tags:
3
+ - physics
4
+ - cosmology
5
  model-index:
6
+ - name: cosmosage_qa
7
  results: []
8
+ license: mit
9
+ language:
10
+ - en
11
+ pipeline_tag: text-generation
12
+ base_model: mistralai/Mistral-7B-v0.1
13
  ---
14
 
15
+ # cosmosage
16
+
17
+ Cosmosage is a natural-language cosmology assistant that can answer questions about cosmology.
18
+
19
+ cosmosage_v2 first underwent continued pretraining based on thousands of papers and textbooks,
20
+ and was subsequently fine-tuned on synthetically-generated question-answer pairs. It is a full
21
+ chat model, though it excels in Q&A mode, where the model gives a single answer in response to
22
+ a single question.
23
+
24
+ The code used to generate cosmosage_v2 is available at https://github.com/tijmen/cosmosage
25
+
26
+ ## Usage
27
+
28
+ After downloading cosmosage_v2, the following example code can be used to ask questions:
29
+
30
+ ```path_to_model = 'cosmosage_v2/'
31
+
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+ import torch
34
+ device = "cuda"
35
+ model = AutoModelForCausalLM.from_pretrained(path_to_model).to(device)
36
+ tokenizer = AutoTokenizer.from_pretrained(path_to_model)
37
+ def ask_cosmosage(question):
38
+ input_ids = torch.cat([
39
+ tokenizer.encode("You are cosmosage, an AI programmed to be a cosmology expert. You answer the USER's question clearly in long form, always providing context. When appropriate, provide a reference.", return_tensors="pt"),
40
+ torch.tensor([[28705]]),
41
+ tokenizer.encode("USER:", add_special_tokens=False, return_tensors="pt"),
42
+ tokenizer.encode(question, add_special_tokens=False, return_tensors="pt"),
43
+ torch.tensor([[28705]]),
44
+ tokenizer.encode("ASSISTANT:", add_special_tokens=False, return_tensors="pt")
45
+ ], dim=-1).to(device)
46
+ generated_ids = model.generate(input_ids, max_length=input_ids.shape[1] + 1000, do_sample=True)
47
+ return tokenizer.decode(generated_ids[0], skip_special_tokens=True)```
48
+
49
+ ## Comparison to cosmosage_v1
50
+
51
+ cosmosage_v2 is a more knowledgeable model than cosmosage_v1 due to being pretrained on the papers and
52
+ textbooks, rather than just on synthetically generated QA pairs. However, it continues to struggle with
53
+ _reliability_. While many of its answers are factually accurate, some are not. The outputs of cosmosage
54
+ (or any LLM) should not be trusted to be factual.
55
 
56
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
57
  <details><summary>See axolotl config</summary>
 
222
  - Transformers 4.38.0.dev0
223
  - Pytorch 2.0.1+cu118
224
  - Datasets 2.17.0
225
+ - Tokenizers 0.15.0