[GH-ISSUE #5784] How to Deploy LLM Based on ollama in an offline environment? #65639

Closed
opened 2026-05-03 21:59:09 -05:00 by GiteaMirror · 15 comments
Owner

Originally created by @RyanOvO on GitHub (Jul 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5784

ollama is now ready and I am deploying based on binary files. I have downloaded the GLM4 model file and the glm4 adaptation file for ollama. However, GLM4 does not provide guff at present. How can I deploy inference glm4 based on ollama in an offline environment?

Originally created by @RyanOvO on GitHub (Jul 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5784 ollama is now ready and I am deploying based on binary files. I have downloaded the GLM4 model file and [the glm4 adaptation file for ollama](https://ollama.com/library/glm4:9b). However, GLM4 does not provide guff at present. How can I deploy inference glm4 based on ollama in an offline environment?
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

If you have downloaded the model with ollama pull glm4:9b, then all you need to do is ollama run glm4:9b to use the model from the command line. If you want API access, you can use the ollama python module:

#!/usr/bin/env python3

import ollama

client = ollama.Client()
print(client.generate(model="glm4:9b", prompt="why is the sky blue?"))

If you have a client that just talks HTTP, you can hit the API endpoint directly, eg with curl:

curl -s http://localhost:11434/api/generate -d '{"model": "glm4:9b", "prompt": "why is the sky blue?", "stream": false}'
<!-- gh-comment-id:2237857012 --> @rick-github commented on GitHub (Jul 19, 2024): If you have downloaded the model with `ollama pull glm4:9b`, then all you need to do is `ollama run glm4:9b` to use the model from the command line. If you want API access, you can use the `ollama` python module: ``` #!/usr/bin/env python3 import ollama client = ollama.Client() print(client.generate(model="glm4:9b", prompt="why is the sky blue?")) ``` If you have a client that just talks HTTP, you can hit the API endpoint directly, eg with curl: ``` curl -s http://localhost:11434/api/generate -d '{"model": "glm4:9b", "prompt": "why is the sky blue?", "stream": false}' ```
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

If you have downloaded the model with ollama pull glm4:9b, then all you need to do is ollama run glm4:9b to use the model from the command line. If you want API access, you can use the ollama python module:

#!/usr/bin/env python3

import ollama

client = ollama.Client()
print(client.generate(model="glm4:9b", prompt="why is the sky blue?"))

If you have a client that just talks HTTP, you can hit the API endpoint directly, eg with curl:

curl -s http://localhost:11434/api/generate -d '{"model": "glm4:9b", "prompt": "why is the sky blue?", "stream": false}'

thanks a lot!
Do you know where to download ollama run?

<!-- gh-comment-id:2237865134 --> @RyanOvO commented on GitHub (Jul 19, 2024): > If you have downloaded the model with `ollama pull glm4:9b`, then all you need to do is `ollama run glm4:9b` to use the model from the command line. If you want API access, you can use the `ollama` python module: > > ``` > #!/usr/bin/env python3 > > import ollama > > client = ollama.Client() > print(client.generate(model="glm4:9b", prompt="why is the sky blue?")) > ``` > > If you have a client that just talks HTTP, you can hit the API endpoint directly, eg with curl: > > ``` > curl -s http://localhost:11434/api/generate -d '{"model": "glm4:9b", "prompt": "why is the sky blue?", "stream": false}' > ``` thanks a lot! Do you know where to download ollama run?
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

If you've installed ollama, ollama is a command that takes parameters to perform actions. run is an action, so just type ollama run glm4:9b to talk to the glm4:9b model.

<!-- gh-comment-id:2237876742 --> @rick-github commented on GitHub (Jul 19, 2024): If you've installed ollama, `ollama` is a command that takes parameters to perform actions. `run` is an action, so just type `ollama run glm4:9b` to talk to the `glm4:9b` model.
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

For example:

rick@z4070 ~ $ ollama run glm4:9b
>>> why is the sky blue?
The sky appears blue because of a phenomenon called Rayleigh scattering, which occurs when sunlight interacts with molecules and particles in Earth's atmosphere.

Here's a simplified explanation of how it happens:

1. **Sunlight Composition**: Sunlight is made up of all the colors of the visible spectrum (red, orange, yellow, green, blue, indigo, and violet), each with its own wavelength.

2. **Rayleigh Scattering**: When sunlight enters Earth's atmosphere, it encounters molecules such as nitrogen and oxygen. These molecules are much smaller than the wavelengths of visible light. When a 
photon (a particle of light) collides with an atom or molecule, the electron in the atom can briefly absorb some of the energy of the photon and then re-emit it.

3. **Frequency Dependency**: Rayleigh scattering is more effective for shorter wavelengths (blue and violet) than for longer wavelengths (red). This means that blue light is scattered more easily in the 
atmosphere than red light.

4. **Directional Scattering**: When the scattered light is directed towards an observer, that observer sees a sky with more of the scattered blue light than any other color. The scattering effect is more 
pronounced at shorter angles from the direction of sunlight (towards the horizon), which gives the sky its characteristic blue appearance during the day.

5. **Atmospheric Conditions**: Weather phenomena like raindrops and cloud particles can enhance Rayleigh scattering, making the sky appear brighter and more vibrant with a stronger blue color.

This is why on a clear, sunny day, when there are few particles in the atmosphere to scatter light, we see a very blue sky. Conversely, at sunrise and sunset, sunlight travels through more of the 
atmosphere before reaching our eyes, so it encounters more scattering. The red colors in the sunrise or sunset are due to Rayleigh scattering that preferentially scatters shorter blue wavelengths away from 
the sun, leaving behind longer-wavelength reds, oranges, and yellows.

>>> /bye
(base) rick@z4070 ~ $
<!-- gh-comment-id:2237898333 --> @rick-github commented on GitHub (Jul 19, 2024): For example: ``` rick@z4070 ~ $ ollama run glm4:9b >>> why is the sky blue? The sky appears blue because of a phenomenon called Rayleigh scattering, which occurs when sunlight interacts with molecules and particles in Earth's atmosphere. Here's a simplified explanation of how it happens: 1. **Sunlight Composition**: Sunlight is made up of all the colors of the visible spectrum (red, orange, yellow, green, blue, indigo, and violet), each with its own wavelength. 2. **Rayleigh Scattering**: When sunlight enters Earth's atmosphere, it encounters molecules such as nitrogen and oxygen. These molecules are much smaller than the wavelengths of visible light. When a photon (a particle of light) collides with an atom or molecule, the electron in the atom can briefly absorb some of the energy of the photon and then re-emit it. 3. **Frequency Dependency**: Rayleigh scattering is more effective for shorter wavelengths (blue and violet) than for longer wavelengths (red). This means that blue light is scattered more easily in the atmosphere than red light. 4. **Directional Scattering**: When the scattered light is directed towards an observer, that observer sees a sky with more of the scattered blue light than any other color. The scattering effect is more pronounced at shorter angles from the direction of sunlight (towards the horizon), which gives the sky its characteristic blue appearance during the day. 5. **Atmospheric Conditions**: Weather phenomena like raindrops and cloud particles can enhance Rayleigh scattering, making the sky appear brighter and more vibrant with a stronger blue color. This is why on a clear, sunny day, when there are few particles in the atmosphere to scatter light, we see a very blue sky. Conversely, at sunrise and sunset, sunlight travels through more of the atmosphere before reaching our eyes, so it encounters more scattering. The red colors in the sunrise or sunset are due to Rayleigh scattering that preferentially scatters shorter blue wavelengths away from the sun, leaving behind longer-wavelength reds, oranges, and yellows. >>> /bye (base) rick@z4070 ~ $ ```
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

If you've installed ollama, ollama is a command that takes parameters to perform actions. run is an action, so just type ollama run glm4:9b to talk to the glm4:9b model.

u are right.But now I find that I failed to download glm4:9b.My idea was to download glm4:9b on my virtual machine and copy it to an offline A10, but obviously I was wrong

<!-- gh-comment-id:2237905591 --> @RyanOvO commented on GitHub (Jul 19, 2024): > If you've installed ollama, `ollama` is a command that takes parameters to perform actions. `run` is an action, so just type `ollama run glm4:9b` to talk to the `glm4:9b` model. u are right.But now I find that I failed to download glm4:9b.My idea was to download glm4:9b on my virtual machine and copy it to an offline A10, but obviously I was wrong
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

For example:

rick@z4070 ~ $ ollama run glm4:9b
>>> why is the sky blue?
The sky appears blue because of a phenomenon called Rayleigh scattering, which occurs when sunlight interacts with molecules and particles in Earth's atmosphere.

Here's a simplified explanation of how it happens:

1. **Sunlight Composition**: Sunlight is made up of all the colors of the visible spectrum (red, orange, yellow, green, blue, indigo, and violet), each with its own wavelength.

2. **Rayleigh Scattering**: When sunlight enters Earth's atmosphere, it encounters molecules such as nitrogen and oxygen. These molecules are much smaller than the wavelengths of visible light. When a 
photon (a particle of light) collides with an atom or molecule, the electron in the atom can briefly absorb some of the energy of the photon and then re-emit it.

3. **Frequency Dependency**: Rayleigh scattering is more effective for shorter wavelengths (blue and violet) than for longer wavelengths (red). This means that blue light is scattered more easily in the 
atmosphere than red light.

4. **Directional Scattering**: When the scattered light is directed towards an observer, that observer sees a sky with more of the scattered blue light than any other color. The scattering effect is more 
pronounced at shorter angles from the direction of sunlight (towards the horizon), which gives the sky its characteristic blue appearance during the day.

5. **Atmospheric Conditions**: Weather phenomena like raindrops and cloud particles can enhance Rayleigh scattering, making the sky appear brighter and more vibrant with a stronger blue color.

This is why on a clear, sunny day, when there are few particles in the atmosphere to scatter light, we see a very blue sky. Conversely, at sunrise and sunset, sunlight travels through more of the 
atmosphere before reaching our eyes, so it encounters more scattering. The red colors in the sunrise or sunset are due to Rayleigh scattering that preferentially scatters shorter blue wavelengths away from 
the sun, leaving behind longer-wavelength reds, oranges, and yellows.

>>> /bye
(base) rick@z4070 ~ $

ok, Now I know how ollama works

<!-- gh-comment-id:2237910589 --> @RyanOvO commented on GitHub (Jul 19, 2024): > For example: > > ``` > rick@z4070 ~ $ ollama run glm4:9b > >>> why is the sky blue? > The sky appears blue because of a phenomenon called Rayleigh scattering, which occurs when sunlight interacts with molecules and particles in Earth's atmosphere. > > Here's a simplified explanation of how it happens: > > 1. **Sunlight Composition**: Sunlight is made up of all the colors of the visible spectrum (red, orange, yellow, green, blue, indigo, and violet), each with its own wavelength. > > 2. **Rayleigh Scattering**: When sunlight enters Earth's atmosphere, it encounters molecules such as nitrogen and oxygen. These molecules are much smaller than the wavelengths of visible light. When a > photon (a particle of light) collides with an atom or molecule, the electron in the atom can briefly absorb some of the energy of the photon and then re-emit it. > > 3. **Frequency Dependency**: Rayleigh scattering is more effective for shorter wavelengths (blue and violet) than for longer wavelengths (red). This means that blue light is scattered more easily in the > atmosphere than red light. > > 4. **Directional Scattering**: When the scattered light is directed towards an observer, that observer sees a sky with more of the scattered blue light than any other color. The scattering effect is more > pronounced at shorter angles from the direction of sunlight (towards the horizon), which gives the sky its characteristic blue appearance during the day. > > 5. **Atmospheric Conditions**: Weather phenomena like raindrops and cloud particles can enhance Rayleigh scattering, making the sky appear brighter and more vibrant with a stronger blue color. > > This is why on a clear, sunny day, when there are few particles in the atmosphere to scatter light, we see a very blue sky. Conversely, at sunrise and sunset, sunlight travels through more of the > atmosphere before reaching our eyes, so it encounters more scattering. The red colors in the sunrise or sunset are due to Rayleigh scattering that preferentially scatters shorter blue wavelengths away from > the sun, leaving behind longer-wavelength reds, oranges, and yellows. > > >>> /bye > (base) rick@z4070 ~ $ > ``` ok, Now I know how ollama works
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

The downloaded model is stored locally (see the faq based on your platform) so you should be able to copy the entire directory to the machine hosting the A10.

<!-- gh-comment-id:2237922692 --> @rick-github commented on GitHub (Jul 19, 2024): The downloaded model is stored locally (see the [faq](https://github.com/ollama/ollama/blob/main/docs/faq.md#where-are-models-stored) based on your platform) so you should be able to copy the entire directory to the machine hosting the A10.
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

thanks a lot ! again!

<!-- gh-comment-id:2237930036 --> @RyanOvO commented on GitHub (Jul 19, 2024): thanks a lot ! again!
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

The downloaded model is stored locally (see the faq based on your platform) so you should be able to copy the entire directory to the machine hosting the A10.

A10 上的ollama如何识别我拷贝过去的glm4:9b呢?

<!-- gh-comment-id:2237945358 --> @RyanOvO commented on GitHub (Jul 19, 2024): > The downloaded model is stored locally (see the [faq](https://github.com/ollama/ollama/blob/main/docs/faq.md#where-are-models-stored) based on your platform) so you should be able to copy the entire directory to the machine hosting the A10. A10 上的ollama如何识别我拷贝过去的glm4:9b呢?
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

You need to install ollama on the machine with the A10. Then copy the model from your virtual machine to the A10 machine. Then start ollama, ollama serve if it's not started as a system service. Then ollama run glm4:9b to talk to the model.

<!-- gh-comment-id:2237948807 --> @rick-github commented on GitHub (Jul 19, 2024): You need to install ollama on the machine with the A10. Then copy the model from your virtual machine to the A10 machine. Then start ollama, `ollama serve` if it's not started as a system service. Then `ollama run glm4:9b` to talk to the model.
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

You need to install ollama on the machine with the A10. Then copy the model from your virtual machine to the A10 machine. Then start ollama, ollama serve if it's not started as a system service. Then ollama run glm4:9b to talk to the model.

I have downloaded the ollama binary package on a10 and started ollama.
My problem is that I copy the glm4:9b downloaded from the VM to the default download path in ollama. ollama automatically recognizes that the model file exists in this path, and the download succeeds, right?

<!-- gh-comment-id:2237953143 --> @RyanOvO commented on GitHub (Jul 19, 2024): > You need to install ollama on the machine with the A10. Then copy the model from your virtual machine to the A10 machine. Then start ollama, `ollama serve` if it's not started as a system service. Then `ollama run glm4:9b` to talk to the model. I have downloaded the ollama binary package on a10 and started ollama. My problem is that I copy the glm4:9b downloaded from the VM to the default download path in ollama. ollama automatically recognizes that the model file exists in this path, and the download succeeds, right?
Author
Owner

@rick-github commented on GitHub (Jul 19, 2024):

Yes. Make that you have copied across the files in the models/blobs and the models/manifests directories. I don't think you need to restart the ollama service after copying, but try that if ollama list doesn't show the glm4:9b model.

<!-- gh-comment-id:2237959844 --> @rick-github commented on GitHub (Jul 19, 2024): Yes. Make that you have copied across the files in the `models/blobs` and the `models/manifests` directories. I don't think you need to restart the ollama service after copying, but try that if `ollama list` doesn't show the glm4:9b model.
Author
Owner

@RyanOvO commented on GitHub (Jul 19, 2024):

Yes. Make that you have copied across the files in the models/blobs and the models/manifests directories. I don't think you need to restart the ollama service after copying, but try that if ollama list doesn't show the glm4:9b model.

ok, u helped me a lot.
thanks bro !

<!-- gh-comment-id:2237981547 --> @RyanOvO commented on GitHub (Jul 19, 2024): > Yes. Make that you have copied across the files in the `models/blobs` and the `models/manifests` directories. I don't think you need to restart the ollama service after copying, but try that if `ollama list` doesn't show the glm4:9b model. ok, u helped me a lot. thanks bro !
Author
Owner

@Pyenb commented on GitHub (Aug 19, 2024):

Hey there, small update for anyone interested. Since this issue was still bothering me, I took matters into my own hands and created an Ollama model repository, where you can download the zipped official ollama models and import them to your offline machine or wherever.

Any feedback is appreciated 👍 More models will be coming soon.

<!-- gh-comment-id:2297174748 --> @Pyenb commented on GitHub (Aug 19, 2024): Hey there, small update for anyone interested. Since this issue was still bothering me, I took matters into my own hands and created an [Ollama model repository](https://github.com/Pyenb/Ollama-models), where you can download the zipped official ollama models and import them to your offline machine or wherever. Any feedback is appreciated 👍 More models will be coming soon.
Author
Owner

@RyanOvO commented on GitHub (Aug 20, 2024):

Hey there, small update for anyone interested. Since this issue was still bothering me, I took matters into my own hands and created an Ollama model repository, where you can download the zipped official ollama models and import them to your offline machine or wherever.

Any feedback is appreciated 👍 More models will be coming soon.

oh,that's great and an amazing work! I gave start

<!-- gh-comment-id:2297873825 --> @RyanOvO commented on GitHub (Aug 20, 2024): > Hey there, small update for anyone interested. Since this issue was still bothering me, I took matters into my own hands and created an [Ollama model repository](https://github.com/Pyenb/Ollama-models), where you can download the zipped official ollama models and import them to your offline machine or wherever. > > Any feedback is appreciated 👍 More models will be coming soon. oh,that's great and an amazing work! I gave start
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#65639