Skip to content

Commit

Permalink
Merge branch 'containers:main' into doc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cgruver authored Feb 7, 2025
2 parents cba644d + 9d02f7d commit e406bd8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Supported transports:
| HuggingFace | [`huggingface.co`](https://www.huggingface.co) |
| Ollama | [`ollama.com`](https://www.ollama.com) |
| OCI Container Registries | [`opencontainers.org`](https://opencontainers.org)|
||Examples: [`quay.io`](https://quay.io), [`Docker Hub`](https://docker.io), and [`Artifactory`](https://artifactory.com)|
||Examples: [`quay.io`](https://quay.io), [`Docker Hub`](https://docker.io), [`Pulp`](https://pulpproject.org), and [`Artifactory`](https://artifactory.com)|

RamaLama uses the Ollama registry transport by default. Use the RAMALAMA_TRANSPORTS environment variable to modify the default. `export RAMALAMA_TRANSPORT=huggingface` Changes RamaLama to use huggingface transport.

Expand Down
2 changes: 1 addition & 1 deletion ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def configure_arguments(parser):
dest="ngl",
type=int,
default=config.get("ngl", -1),
help="Number of layers to offload to the gpu, if available"
help="Number of layers to offload to the gpu, if available",
)
parser.add_argument(
"--keep-groups",
Expand Down
3 changes: 2 additions & 1 deletion ramalama/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
MNT_FILE = f"{MNT_DIR}/model.file"
HTTP_RANGE_NOT_SATISFIABLE = 416

DEFAULT_IMAGE="quay.io/ramalama/ramalama"
DEFAULT_IMAGE = "quay.io/ramalama/ramalama"


def container_manager():
engine = os.getenv("RAMALAMA_CONTAINER_ENGINE")
Expand Down
9 changes: 8 additions & 1 deletion ramalama/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,21 @@ def perform_download(self, file, progress):
self.total_to_download += self.file_size
self.now_downloaded = 0
self.start_time = time.time()
accumulated_size = 0
last_update_time = time.time()
while True:
data = self.response.read(1024)
if not data:
break

size = file.write(data)
if progress:
self.update_progress(size)
accumulated_size += size
if time.time() - last_update_time >= 0.1:
self.now_downloaded += accumulated_size
self.update_progress(self.now_downloaded, self.total_to_download)
accumulated_size = 0
last_update_time = time.time()

def human_readable_time(self, seconds):
hrs = int(seconds) // 3600
Expand Down

0 comments on commit e406bd8

Please sign in to comment.