Skip to content

Commit 88735df

Browse files
committed
Updated package v4.22
1 parent df2ed34 commit 88735df

File tree

6 files changed

+60
-6
lines changed

6 files changed

+60
-6
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
All notable changes to LocalLab will be documented in this file.
44

5+
## 0.4.22 - 2025-03-12
6+
7+
### Fixed
8+
9+
- Fixed critical issue with server not terminating properly when Ctrl+C is pressed
10+
- Improved process termination by using os.\_exit() instead of sys.exit() for clean shutdown
11+
- Added CPU compatibility by disabling quantization when CUDA is not available
12+
- Fixed bitsandbytes error for CPU-only systems with clear warning messages
13+
- Enhanced user experience with better error handling for non-GPU environments
14+
15+
### Added
16+
17+
- Added beautiful footer section with author information and social media links
18+
- Included GitHub, Twitter, and Instagram links in the footer
19+
- Added project repository link with star request
20+
- Enhanced server startup display with comprehensive information
21+
522
## 0.4.21 - 2025-03-12
623

724
### Fixed

locallab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LocalLab - A lightweight AI inference server for running LLMs locally
33
"""
44

5-
__version__ = "0.4.21"
5+
__version__ = "0.4.22"
66

77
# Only import what's necessary initially, lazy-load the rest
88
from .logger import get_logger

locallab/model_manager.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ def _get_quantization_config(self) -> Optional[Dict[str, Any]]:
6868
# Use the config system to get the value, which checks environment variables and config file
6969
from .cli.config import get_config_value
7070

71+
# First check if CUDA is available - if not, we can't use bitsandbytes quantization
72+
if not torch.cuda.is_available():
73+
logger.warning("CUDA not available - quantization with bitsandbytes requires CUDA")
74+
logger.info("Disabling quantization and using CPU-compatible settings")
75+
return {
76+
"torch_dtype": torch.float32,
77+
"device_map": "auto"
78+
}
79+
7180
enable_quantization = get_config_value('enable_quantization', ENABLE_QUANTIZATION)
7281
# Convert string values to boolean if needed
7382
if isinstance(enable_quantization, str):

locallab/server.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ def delayed_exit():
203203
except Exception:
204204
pass
205205

206-
# Force exit if we're still running
207-
sys.exit(0)
206+
# Force exit the process completely - use os._exit instead of sys.exit
207+
# This ensures all threads are terminated
208+
logger.info("Forcing process termination to ensure clean shutdown")
209+
os._exit(0)
208210

209211
threading.Thread(target=delayed_exit, daemon=True).start()
210212

@@ -236,7 +238,6 @@ def __init__(self, config):
236238
self.started = False
237239
self._serve_task = None
238240
self._socket = None
239-
self._running = False
240241
self.app = config.app
241242

242243
async def start(self):
@@ -902,6 +903,14 @@ def on_startup():
902903
except Exception as e:
903904
logger.error(f"Error displaying API documentation: {str(e)}")
904905
logger.debug(f"API documentation error details: {traceback.format_exc()}")
906+
907+
try:
908+
# Display footer with author information
909+
from .ui.banners import print_footer
910+
print_footer()
911+
except Exception as e:
912+
logger.error(f"Error displaying footer: {str(e)}")
913+
logger.debug(f"Footer display error details: {traceback.format_exc()}")
905914

906915
# Set flag to indicate startup is complete
907916
startup_complete = True

locallab/ui/banners.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,23 @@ def print_api_docs():
273273
def format_multiline_text(text: str, prefix: str = "") -> str:
274274
"""Format multiline text for display in a banner"""
275275
lines = text.strip().split('\n')
276-
return '\n'.join([f"{prefix}{line}" for line in lines])
276+
return '\n'.join([f"{prefix}{line}" for line in lines])
277+
278+
279+
def print_footer():
280+
"""Print a footer with author information and social media links."""
281+
footer = f"""
282+
{Fore.CYAN}┌────────────────────────── Made with ❤️ ───────────────────────────┐{Style.RESET_ALL}
283+
│ │
284+
{Fore.YELLOW}Created by:{Style.RESET_ALL} Utkarsh Tiwari │
285+
{Fore.BLUE}GitHub:{Style.RESET_ALL} https://github.com/UtkarshTheDev │
286+
{Fore.MAGENTA}Twitter:{Style.RESET_ALL} https://twitter.com/UtkarshTheDev │
287+
{Fore.RED}Instagram:{Style.RESET_ALL} https://instagram.com/UtkarshTheDev │
288+
│ │
289+
{Fore.GREEN}⭐ Star this project:{Style.RESET_ALL} https://github.com/UtkarshTheDev/LocalLab │
290+
│ │
291+
{Fore.YELLOW}Thank you for using LocalLab! Feedback and contributions welcome!{Style.RESET_ALL}
292+
│ │
293+
{Fore.CYAN}└────────────────────────────────────────────────────────────────────┘{Style.RESET_ALL}
294+
"""
295+
print(footer, flush=True)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="locallab",
8-
version="0.4.21",
8+
version="0.4.22",
99
packages=find_packages(include=["locallab", "locallab.*"]),
1010
install_requires=[
1111
"fastapi>=0.95.0,<1.0.0",

0 commit comments

Comments
 (0)