rukaiyaaaah commited on
Commit
2ea93f3
1 Parent(s): deeccfd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md CHANGED
@@ -31,4 +31,50 @@ roadGPT will process your query, referencing the relevant IRC guidelines to prov
31
  ### Deployment:
32
  roadGPT is proudly hosted on Huggingface, making it accessible to professionals, students, and road safety advocates worldwide. Our user-friendly interface ensures that you can get the answers you need with just a few clicks, regardless of your technical expertise.
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  Dive into the world of road engineering with roadGPT at your side. Whether you're drafting a project, studying for your next exam, or simply curious about road regulations, roadGPT is here to guide you according to the esteemed IRC guidelines. Start your query now and experience the future of road-related assistance.
 
31
  ### Deployment:
32
  roadGPT is proudly hosted on Huggingface, making it accessible to professionals, students, and road safety advocates worldwide. Our user-friendly interface ensures that you can get the answers you need with just a few clicks, regardless of your technical expertise.
33
 
34
+ ### Inference
35
+ Quickly get inference running with the following required installation:
36
+ ```bash
37
+ pip install ai2-olmo
38
+ ```
39
+ Now, proceed as usual with HuggingFace:
40
+ ```python
41
+ import os
42
+ from transformers import (
43
+ AutoModelForCausalLM,
44
+ AutoTokenizer,
45
+ BitsAndBytesConfig,
46
+ pipeline,
47
+ )
48
+ from transformers import BitsAndBytesConfig
49
+
50
+ bnb_config = BitsAndBytesConfig(
51
+ load_in_4bit=True,
52
+ bnb_4bit_quant_type="nf4",
53
+ bnb_4bit_compute_dtype="float16",
54
+ bnb_4bit_use_double_quant=False,
55
+ )
56
+
57
+ model_name = "rukaiyah-indika-ai/rv-chatbot-2"
58
+
59
+ model = AutoModelForCausalLM.from_pretrained(
60
+ model_name,
61
+ quantization_config=bnb_config
62
+ )
63
+
64
+ def generate_response(prompt):
65
+ inst = "You are a very helpful assistant providing solutions to road-related queries. Ensure you provide correct and relevant answers according to the IRC guidelines. If you don't know the answer to a question, please don't share false information."
66
+ prompt = "What are potholes, and how do they appear? "
67
+ pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, temperature=0.2, max_new_tokens=256)
68
+ ranked_results = pipe(f"<s>[INST] {inst}{prompt} [/INST]")
69
+
70
+ for result in ranked_results:
71
+ response = result['generated_text']
72
+ response = response.split("[/INST]", 1)[-1]
73
+ response = response.replace("<s>", "")
74
+ response = response.replace("</s>", "")
75
+ return response
76
+
77
+ >> ' Potholes are bowl-shaped cavities in pavements caused by localized disintegration. They vary in size: small (25mm deep, 200mm wide), medium (25-50mm deep, up to 500mm wide), and large (exceeding 50mm deep, more than 500mm wide). Factors like water infiltration, traffic stress, and weathering lead to their development by breaking down pavement layers.'
78
+
79
+
80
  Dive into the world of road engineering with roadGPT at your side. Whether you're drafting a project, studying for your next exam, or simply curious about road regulations, roadGPT is here to guide you according to the esteemed IRC guidelines. Start your query now and experience the future of road-related assistance.