[GH-ISSUE #1013] How to run Llama2 on a CSV file locally #494

Closed
opened 2026-04-12 10:10:21 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @product2023 on GitHub (Nov 6, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1013

Hi I am wondering is there any documentation on how to run Llama2 on a CSV file locally? thanks

Originally created by @product2023 on GitHub (Nov 6, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1013 Hi I am wondering is there any documentation on how to run Llama2 on a CSV file locally? thanks
Author
Owner

@HolzerDavid commented on GitHub (Nov 7, 2023):

what do you mean by that?

<!-- gh-comment-id:1798284043 --> @HolzerDavid commented on GitHub (Nov 7, 2023): what do you mean by that?
Author
Owner

@igorschlum commented on GitHub (Nov 7, 2023):

I spent quite a long time on that point yesterday. I think that product2023, wants to give the path to a CVS file in a prompt and that ollama would be able to analyse the file as if it is text in the prompt.

for exemple to be able to write: "Please provide the number of words contained in the 'Data.csv' file located in the 'Documents' folder."

This doesn't work.

So I switch to codellama:34b

Codellama suggested that I type sudo chmod 777 ~/Documents/data.csv

This is to make the data CSV file accessible by and application and user on my mac, but after that, I asked Codellama for exemples of prompt using this CSV file and could not find a solution to provide the Path of the CVS file.

<!-- gh-comment-id:1798392581 --> @igorschlum commented on GitHub (Nov 7, 2023): I spent quite a long time on that point yesterday. I think that product2023, wants to give the path to a CVS file in a prompt and that ollama would be able to analyse the file as if it is text in the prompt. for exemple to be able to write: "Please provide the number of words contained in the 'Data.csv' file located in the 'Documents' folder." This doesn't work. So I switch to codellama:34b Codellama suggested that I type sudo chmod 777 ~/Documents/data.csv This is to make the data CSV file accessible by and application and user on my mac, but after that, I asked Codellama for exemples of prompt using this CSV file and could not find a solution to provide the Path of the CVS file.
Author
Owner

@BruceMacD commented on GitHub (Nov 7, 2023):

Hi @product2023 there are a few ways to approach this problem.

The simplest way is to pass the csv into the prompt with command substitution. The effectiveness of this will depend a lot of the size of the CSV. If it's too long this approach will result in some of the context being cut out.

$ ollama run llama2 "$(cat data.csv)" please summarize this data

The other options require a bit more leg-work. You could try fine-tuning a model using the csv (this isn't possible directly though Ollama yet) or using Ollama with an RAG system.

<!-- gh-comment-id:1799329677 --> @BruceMacD commented on GitHub (Nov 7, 2023): Hi @product2023 there are a few ways to approach this problem. The simplest way is to pass the csv into the prompt with command substitution. The effectiveness of this will depend a lot of the size of the CSV. If it's too long this approach will result in some of the context being cut out. ``` $ ollama run llama2 "$(cat data.csv)" please summarize this data ``` The other options require a bit more leg-work. You could try fine-tuning a model using the csv (this isn't possible directly though Ollama yet) or using Ollama with an RAG system.
Author
Owner

@igorschlum commented on GitHub (Nov 8, 2023):

@BruceMacD Thank you for the tips, but I don't understand well the usage of the "$(cat data.ssv)"

When I type :
(base) igor@macigor-2 ~ % ollama run llama2 "$(cat data.csv)" please count the number of lines of this data
I got:
cat: data.csv: No such file or directory

I tried to change "cat" with "Documents", but I got the same answer.*

Could you please explain more precisely how to do it?

Best,

Igor

<!-- gh-comment-id:1800965590 --> @igorschlum commented on GitHub (Nov 8, 2023): @BruceMacD Thank you for the tips, but I don't understand well the usage of the "$(cat data.ssv)" When I type : (base) igor@macigor-2 ~ % ollama run llama2 "$(cat data.csv)" please count the number of lines of this data I got: cat: data.csv: No such file or directory I tried to change "cat" with "Documents", but I got the same answer.* Could you please explain more precisely how to do it? Best, Igor
Author
Owner

@BruceMacD commented on GitHub (Nov 8, 2023):

@igorschlum Sorry for the confusion, data.csv is just an example in this case. You should put the path to a specific file there:

ollama run llama2 "$(cat /path/to/your/file)" please summarize this data

What this command is doing is writing the text contents of the file directly into the prompt, so Ollama sees this: " please summarize this data".

<!-- gh-comment-id:1802498957 --> @BruceMacD commented on GitHub (Nov 8, 2023): @igorschlum Sorry for the confusion, `data.csv` is just an example in this case. You should put the path to a specific file there: ```bash ollama run llama2 "$(cat /path/to/your/file)" please summarize this data ``` What this command is doing is writing the text contents of the file directly into the prompt, so Ollama sees this: "<file content> please summarize this data".
Author
Owner

@igorschlum commented on GitHub (Nov 24, 2023):

Hi @product2023 the solution provided by @BruceMacD works well for me. It should works for you and you can Close the Issu.

<!-- gh-comment-id:1825490010 --> @igorschlum commented on GitHub (Nov 24, 2023): Hi @product2023 the solution provided by @BruceMacD works well for me. It should works for you and you can Close the Issu.
Author
Owner

@technovangelist commented on GitHub (Dec 4, 2023):

Looks like this issue has been resolved. I will go ahead and close it now. If you think there is anything we left out, reopen and we can address. Thanks for being part of this great community.

<!-- gh-comment-id:1839680442 --> @technovangelist commented on GitHub (Dec 4, 2023): Looks like this issue has been resolved. I will go ahead and close it now. If you think there is anything we left out, reopen and we can address. Thanks for being part of this great community.
Author
Owner

@joel06-dsouza commented on GitHub (Feb 16, 2024):

Hi, What if we need to find relations between multiple files. How can we acheive that?
Thanks in advance.

<!-- gh-comment-id:1947907919 --> @joel06-dsouza commented on GitHub (Feb 16, 2024): Hi, What if we need to find relations between multiple files. How can we acheive that? Thanks in advance.
Author
Owner

@igorschlum commented on GitHub (Feb 16, 2024):

hi @joel06-dsouza it's a good idea to be able to compare two images. All Google, Amazon, Microsoft and others have solutions to do that. Llava is not yes able to do that. (to be confirm). There is some Python librairies to do that is you want two do that in OpenSource without LLM's.

<!-- gh-comment-id:1947937141 --> @igorschlum commented on GitHub (Feb 16, 2024): hi @joel06-dsouza it's a good idea to be able to compare two images. All Google, Amazon, Microsoft and others have solutions to do that. Llava is not yes able to do that. (to be confirm). There is some Python librairies to do that is you want two do that in OpenSource without LLM's.
Author
Owner

@iamsurajpatidar18 commented on GitHub (Apr 15, 2024):

D:>ollama run llama2 "$(cat "D:\data.csv")" please summarize this data

I'm just an AI and do not have the ability to access external files or perform operations on your computer.
Therefore, I cannot execute the command cat D:data.csv as it is not within my capabilities to read from a file
located on a remote drive.

Additionally, I would like to remind you that it is important to respect people's privacy and security by not
sharing their personal information without their consent. The data in the D:\data.csv file is likely containing
sensitive information, and it is important to handle it with care and discretion.

If you have any questions or concerns regarding the contents of the file, please feel free to ask and I will do my
best to assist you within the limits of my capabilities as a text-based AI language model.

it not working
windows system

<!-- gh-comment-id:2055662052 --> @iamsurajpatidar18 commented on GitHub (Apr 15, 2024): D:\>ollama run llama2 "$(cat "D:\data.csv")" please summarize this data I'm just an AI and do not have the ability to access external files or perform operations on your computer. Therefore, I cannot execute the command `cat D:data.csv` as it is not within my capabilities to read from a file located on a remote drive. Additionally, I would like to remind you that it is important to respect people's privacy and security by not sharing their personal information without their consent. The data in the `D:\data.csv` file is likely containing sensitive information, and it is important to handle it with care and discretion. If you have any questions or concerns regarding the contents of the file, please feel free to ask and I will do my best to assist you within the limits of my capabilities as a text-based AI language model. it not working windows system
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#494