Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements-no-gpu-uv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ tqdm==4.66.5
# peft
# sentence-transformers
# transformers
transformerlab==0.0.32
transformerlab==0.0.33
# via
# -r requirements.in
# transformerlab-inference
Expand Down
2 changes: 1 addition & 1 deletion requirements-rocm-uv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ tqdm==4.66.5
# peft
# sentence-transformers
# transformers
transformerlab==0.0.32
transformerlab==0.0.33
# via
# -r requirements-rocm.in
# transformerlab-inference
Expand Down
2 changes: 1 addition & 1 deletion requirements-rocm.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ hf_xet
macmon-python
mcp[cli]
transformerlab-inference==0.2.51
transformerlab==0.0.32
transformerlab==0.0.33
diffusers==0.33.1
pyrsmi
controlnet_aux==0.0.10
Expand Down
2 changes: 1 addition & 1 deletion requirements-uv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ tqdm==4.66.5
# peft
# sentence-transformers
# transformers
transformerlab==0.0.32
transformerlab==0.0.33
# via
# -r requirements.in
# transformerlab-inference
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ markitdown[all]
hf_xet
macmon-python
transformerlab-inference==0.2.51
transformerlab==0.0.32
transformerlab==0.0.33
diffusers==0.33.1
nvidia-ml-py
mcp[cli]
Expand Down
39 changes: 29 additions & 10 deletions transformerlab/shared/s3_mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def is_macos() -> bool:
def get_s3_mount_command() -> str:
"""
Get the appropriate S3 mounting command based on the platform.

Returns:
The command to use for S3 mounting ('mount-s3' for Linux, 's3fs' for macOS)
"""
Expand All @@ -33,10 +33,10 @@ def get_s3_mount_command() -> str:
def is_fuse_mount(path):
"""
Check if the given path is mounted as a FUSE filesystem.

Args:
path: The path to check for FUSE mount

Returns:
Tuple of (is_fuse, fstype, mountpoint) where:
- is_fuse: Boolean indicating if it's a FUSE mount
Expand All @@ -53,8 +53,6 @@ def is_fuse_mount(path):
return False, None, None




def run_s3_mount_command(bucket_name: str, remote_workspace_dir: str, profile: str = "transformerlab-s3") -> bool:
"""
Run the appropriate S3 mounting command (mount-s3 for Linux, s3fs for macOS).
Expand All @@ -68,21 +66,43 @@ def run_s3_mount_command(bucket_name: str, remote_workspace_dir: str, profile: s
True if mount command succeeded, False otherwise
"""
try:
from lab import HOME_DIR

# Create the remote workspace directory if it doesn't exist
os.makedirs(remote_workspace_dir, exist_ok=True)
print(f"Created/verified remote workspace directory: {remote_workspace_dir}")

mount_command = get_s3_mount_command()

if mount_command == "s3fs":
# s3fs command for macOS
# s3fs supports AWS profiles through ~/.aws/credentials
# Format: s3fs bucket_name mount_point -o profile=profile_name
cmd = ["s3fs", bucket_name, remote_workspace_dir, "-o", f"profile={profile}"]
else:
# mount-s3 command for Linux
cmd = ["mount-s3", "--profile", profile, bucket_name, remote_workspace_dir, "--allow-overwrite", "--allow-delete"]

cmd = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any potential performance hit here or anything? Just wondering if we want to be able to disable in prod or do you think it'll be extra desireable in prod? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this should be for dev only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a debug mode and added for s3fs

"mount-s3",
"--profile",
profile,
bucket_name,
remote_workspace_dir,
"--allow-overwrite",
"--allow-delete"
]

if os.getenv("TFL_DEBUG") == "true":
if mount_command == "s3fs":
if not os.path.exists(f"{HOME_DIR}/s3-mount-logs"):
os.makedirs(f"{HOME_DIR}/s3-mount-logs")
if not os.path.exists(f"{HOME_DIR}/s3-mount-logs/s3fs.log"):
open(f"{HOME_DIR}/s3-mount-logs/s3fs.log", "w").close()
# s3fs debug options: -d for debug, --curldbg for curl debug, --logfile for log file, dbglevel=info
cmd.extend(["-d", "-o", "curldbg", "-o",f"logfile={HOME_DIR}/s3-mount-logs/s3fs.log", "-o", "dbglevel=info"])
else:
# mount-s3 debug options (keep existing)
cmd.extend(["--debug", "--debug-crt", "--log-directory", f"{HOME_DIR}/s3-mount-logs"])

print(f"Running mount command: {' '.join(cmd)}")

result = subprocess.run(
Expand Down Expand Up @@ -158,12 +178,11 @@ def setup_user_s3_mount(user_id: str, organization_id: str | None = None) -> boo
if os.path.exists(bucket_remote_path):
print(f"Removing existing directory {bucket_remote_path} (not a FUSE mount)")
shutil.rmtree(bucket_remote_path)

# Create the directory
os.makedirs(bucket_remote_path, exist_ok=True)
print(f"Created directory: {bucket_remote_path}")


# Run the S3 mount command (mount-s3 for Linux, s3fs for macOS)
success = run_s3_mount_command(bucket_name, bucket_remote_path)

Expand Down
Loading