joshnguyen commited on
Commit
3ee1192
·
1 Parent(s): 4fc6d9e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +48 -2
README.md CHANGED
@@ -13,6 +13,52 @@ tags:
13
  - astronomy
14
  - astrophysics
15
  ---
16
- ## Training procedure
17
 
18
- ### Framework versions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - astronomy
14
  - astrophysics
15
  ---
 
16
 
17
+ <p><h1>AstroLLaMA</h1></p>
18
+
19
+ <p align="center">
20
+ <img src="https://huggingface.co/universeTBD/astrollama/resolve/main/images/astrollama-logo.png" alt="AstroLLaMA" width="500px"/>
21
+ </p>
22
+
23
+ ## Loading the model
24
+
25
+ ```python
26
+ from transformers import AutoModelForCausalLM
27
+ from transformers import AutoTokenizer
28
+
29
+ tokenizer = AutoTokenizer.from_pretrained(
30
+ pretrained_model_name_or_path="universeTBD/astrollama"
31
+ )
32
+ model = AutoModelForCausalLM.from_pretrained(
33
+ pretrained_model_name_or_path="universeTBD/astrollama",
34
+ device_map="auto",
35
+ )
36
+ ```
37
+
38
+ ## Generating text from a prompt
39
+
40
+ ```python
41
+ import torch
42
+ from transformers import pipeline
43
+
44
+ generator = pipeline(
45
+ task="text-generation",
46
+ model=model,
47
+ tokenizer="tokenizer",
48
+ device_map="auto"
49
+ )
50
+
51
+ # Taken from https://arxiv.org/abs/2308.12823
52
+ prompt = "In this letter, we report the discovery of the highest redshift, " \
53
+ "heavily obscured, radio-loud QSO candidate selected using JWST NIRCam/MIRI, " \
54
+ "mid-IR, sub-mm, and radio imaging in the COSMOS-Web field. "
55
+
56
+ # For reproducibility
57
+ torch.manual_seed(42)
58
+
59
+ generated_text = generator(
60
+ prompt,
61
+ do_sample=True,
62
+ max_length=512
63
+ )
64
+ ```