mertNB commited on
Commit
41bbbd3
1 Parent(s): a1ff880

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -7
README.md CHANGED
@@ -15,11 +15,7 @@ tags:
15
  Rago v2 13B model is a retrieval-augmented generation-optimized (RAGO) model that enhances large language models by integrating an external authoritative knowledge base (context) for generating responses. This integration significantly improves the model's ability to produce relevant, accurate, and context-specific output across specialized domains or internal data without necessitating retraining. It addresses key challenges of large language models (LLMs), such as unpredictability, reliance on potentially outdated data, and the propagation of incorrect information, thereby improving user trust in AI applications. Rago v2 13B, specifically, is an advancement built upon the [Llama 2 13B](https://huggingface.co/meta-llama/Llama-2-13b-hf) model, optimized for retrieval-augmented generation, making it particularly effective in contextually aware response generation.
16
 
17
  ```python
18
- from transformers import AutoTokenizer, AutoModelForCausalLM
19
- import transformers
20
- import torch
21
-
22
- model = "neural-bridge/Rago-v2-13b"
23
 
24
  tokenizer = AutoTokenizer.from_pretrained(model)
25
  pipeline = transformers.pipeline(
@@ -30,14 +26,27 @@ pipeline = transformers.pipeline(
30
  trust_remote_code=True,
31
  device_map="auto",
32
  )
 
 
 
 
33
  sequences = pipeline(
34
- "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
 
 
 
35
  max_length=200,
36
  do_sample=True,
37
  top_k=10,
38
  num_return_sequences=1,
39
  eos_token_id=tokenizer.eos_token_id,
40
  )
 
 
 
 
 
 
41
  for seq in sequences:
42
- print(f"Result: {seq['generated_text']}")
43
  ```
 
15
  Rago v2 13B model is a retrieval-augmented generation-optimized (RAGO) model that enhances large language models by integrating an external authoritative knowledge base (context) for generating responses. This integration significantly improves the model's ability to produce relevant, accurate, and context-specific output across specialized domains or internal data without necessitating retraining. It addresses key challenges of large language models (LLMs), such as unpredictability, reliance on potentially outdated data, and the propagation of incorrect information, thereby improving user trust in AI applications. Rago v2 13B, specifically, is an advancement built upon the [Llama 2 13B](https://huggingface.co/meta-llama/Llama-2-13b-hf) model, optimized for retrieval-augmented generation, making it particularly effective in contextually aware response generation.
16
 
17
  ```python
18
+ model = "neural-bridge/Rago-v2-7b"
 
 
 
 
19
 
20
  tokenizer = AutoTokenizer.from_pretrained(model)
21
  pipeline = transformers.pipeline(
 
26
  trust_remote_code=True,
27
  device_map="auto",
28
  )
29
+
30
+ def create_prompt(context, question):
31
+ return f"""##CONTEXT## {context} ##QUESTION## {question} ##ANSWER##"""
32
+
33
  sequences = pipeline(
34
+ create_prompt(
35
+ context="Neural Bridge AI is a software company developing artificial intelligence (AI) solutions. It is founded in New York in the USA.",
36
+ question="What solutions does Neural Bridge AI develop for its clients?"
37
+ ),
38
  max_length=200,
39
  do_sample=True,
40
  top_k=10,
41
  num_return_sequences=1,
42
  eos_token_id=tokenizer.eos_token_id,
43
  )
44
+
45
+ def print_result(generated_text):
46
+ result_start = "##ANSWER##"
47
+ answer_start = generated_text.find(result_start)
48
+ print(generated_text[answer_start + len(result_start) :].strip())
49
+
50
  for seq in sequences:
51
+ print_result(seq["generated_text"])
52
  ```