llama-index,uncharted and llama2:7b run locally to generate Index
创始人
2025-01-08 03:33:43
0

题意:本地运行 llama-indexuncharted 以及 llama2:7b 来生成索引

问题背景:

I wanted to use llama-index locally with ollama and llama3:8b to index utf-8 json file. I dont have a gpu. I use uncharted to convert docs into json. Now If it is not possible to use llama-index locally without GPU I wanted to use hugging face inference API. But I am not certain if it is free. Can anyone suggest a way?

This is my python code:

from llama_index.core import Document, SimpleDirectoryReader, VectorStoreIndex     from llama_index.llms.ollama import Ollama     import json     from llama_index.core import Settings               # Convert the JSON document into LlamaIndex Document objects     with open('data/UBER_2019.json', 'r',encoding='utf-8') as f:         json_doc = json.load(f)     documents = [Document(text=str(doc)) for doc in json_doc]          # Initialize Ollama with the local LLM     ollama_llm = Ollama(model="llama3:8b")     Settings.llm = ollama_llm          # Create the index using the local LLM     index = VectorStoreIndex.from_documents(documents)#, llm=ollama_llm)

But i keep getting error that there is no OPENAI key. I wanted to use llama2 so that i dont require OPENAI key

Can anyone suggest what i am doing wrong? Also can i use huggingfaceinference API to do indexing of a local json file for free?

问题解决:

You are not setting the embedding model, so I think Llama Index is defaulting to OpenAI.
You must specify an embedding model that does not require an API key.

You can use Ollama:

from llama_index.embeddings.ollama import OllamaEmbedding  # Using Nomic Settings.embed_model = OllamaEmbedding(model_name="nomic-embed-text")  # Using Llama Settings.embed_model = OllamaEmbedding(model_name="llama2")

But there are many options in the documentation like this, this, this

相关内容

热门资讯

9分钟下载!wepoker手机... 9分钟下载!wepoker手机插件,hhpoker哪个俱乐部靠谱,透牌教程(今日头条)-哔哩哔哩;最...
第9分钟介绍!约局吧有没有挂(... 第9分钟介绍!约局吧有没有挂(外挂)原来是有挂工具(教会开挂下载);约局吧有没有挂免费下载原版,在约...
4分钟带你讲解!欢欢辅助软件怎... 4分钟带你讲解!欢欢辅助软件怎么样,顺欣茶楼辅助视频,教你攻略(真的有挂)-哔哩哔哩;打开点击测试直...
绝活儿外挂!wepoker有没... 绝活儿外挂!wepoker有没有挂,pokemmo辅助器手机版下载,黑科技教程(真是有挂)-哔哩哔哩...
八分钟了解!手游辅助平台(外挂... 八分钟了解!手游辅助平台(外挂)原来确实有挂插件(实测开挂脚本);1、点击下载安装,手游辅助平台插件...
七分钟了解!黑桃k辅助,wer... 七分钟了解!黑桃k辅助,werplan怎么透视,透视教程(有挂方法)-哔哩哔哩;黑桃k辅助是一款益智...
三分钟带你发现!新上游辅助,福... 福建天天开心辅助器是真的吗是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户...
烘培外挂!wpk有辅助吗,we... 【亲,we poker游戏下 这款游戏可以开挂的,确实是有挂的,很多玩家在这款we poker游戏下...
第1分钟指导!山西扣点子技巧,... 第1分钟指导!山西扣点子技巧,wpk真吗,2026新版技巧(详细教程)-哔哩哔哩;致您一封信;亲爱山...
十分钟得知!微信小程序游戏充值... 十分钟得知!微信小程序游戏充值破解(外挂)原来真的有挂平台(发现开挂软件);微信小程序游戏充值破解是...