@@ -1451,3 +1451,4 @@ openhathi
sarvam
subtask
acc
+langchain
@@ -94,6 +94,10 @@ To use the sensitive topics safety checker install with:
```
pip install llama-recipes[auditnlg]
+Some recipes require the presence of langchain. To install the packages follow the recipe description or install with:
+```
+pip install llama-recipes[langchain]
Optional dependencies can also be combines with [option1,option2].
#### Install from source
@@ -24,6 +24,7 @@ dynamic = ["dependencies"]
vllm = ["vllm"]
tests = ["pytest-mock"]
auditnlg = ["auditnlg"]
+langchain = ["langchain_openai", "langchain", "langchain_community"]
[project.urls]
"Homepage" = "https://github.com/facebookresearch/llama-recipes/"
@@ -6,7 +6,6 @@ import sys
import time
import fire
-import gradio as gr
import torch
@@ -146,6 +145,11 @@ def main(
user_prompt = "\n".join(sys.stdin.readlines())
inference(user_prompt, temperature, top_p, top_k, max_new_tokens)
else:
+ try:
+ import gradio as gr
+ except ImportError:
+ raise ImportError("This part of the recipe requires gradio. Please run `pip install gradio`")
+
gr.Interface(
fn=inference,
inputs=[
@@ -14,7 +14,6 @@ py7zr
scipy
optimum
matplotlib
-gradio
chardet
openai
typing-extensions==4.8.0
@@ -24,8 +23,5 @@ rouge_score
pyyaml==6.0.1
faiss-gpu; python_version < '3.11'
unstructured[pdf]
-langchain_openai
-langchain
-langchain_community
sentence_transformers
codeshield