Update README.md
Browse files
README.md
CHANGED
|
@@ -24,6 +24,8 @@ Copy code
|
|
| 24 |
from transformers import pipeline
|
| 25 |
|
| 26 |
# Load the model from Hugging Face
|
|
|
|
|
|
|
| 27 |
import torch
|
| 28 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 29 |
|
|
@@ -34,19 +36,17 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 34 |
# llm_int8_enable_fp32_cpu_offload=True
|
| 35 |
)
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained("pitangent-ds/academic_phy")
|
| 37 |
-
|
| 38 |
# Perform inference
|
|
|
|
| 39 |
text = "What are units ?"
|
| 40 |
inputs = tokenizer(text, return_tensors="pt")
|
| 41 |
outputs = model.generate(**inputs)
|
| 42 |
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 43 |
|
| 44 |
print(decoded_output)
|
|
|
|
| 45 |
|
| 46 |
-
# Ask a question
|
| 47 |
-
question = "what are units?"
|
| 48 |
-
response = qa_pipeline(data)
|
| 49 |
-
print(response["answer"])
|
| 50 |
|
| 51 |
# Training Details
|
| 52 |
Dataset: Curated ICSE Physics content for Classes 9 and 10 textbooks
|
|
|
|
| 24 |
from transformers import pipeline
|
| 25 |
|
| 26 |
# Load the model from Hugging Face
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
import torch
|
| 30 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 31 |
|
|
|
|
| 36 |
# llm_int8_enable_fp32_cpu_offload=True
|
| 37 |
)
|
| 38 |
tokenizer = AutoTokenizer.from_pretrained("pitangent-ds/academic_phy")
|
| 39 |
+
```
|
| 40 |
# Perform inference
|
| 41 |
+
```python
|
| 42 |
text = "What are units ?"
|
| 43 |
inputs = tokenizer(text, return_tensors="pt")
|
| 44 |
outputs = model.generate(**inputs)
|
| 45 |
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 46 |
|
| 47 |
print(decoded_output)
|
| 48 |
+
```
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# Training Details
|
| 52 |
Dataset: Curated ICSE Physics content for Classes 9 and 10 textbooks
|