-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Add local model worker parameters #2974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ class OllamaLLMModelParams(BaseForm): | |
| _step=0.01, | ||
| precision=2) | ||
|
|
||
| max_tokens = forms.SliderField( | ||
| num_predict = forms.SliderField( | ||
| TooltipLabel(_('Output the maximum Tokens'), | ||
| _('Specify the maximum number of tokens that the model can generate')), | ||
| required=True, default_value=1024, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code snippet you provided has a small typo in Updated Code Snippet: num_predict = forms.SliderField(No other significant issues or optimizations are present in this particular part of the code. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,7 +93,8 @@ class Config(dict): | |
| 'SANDBOX': False, | ||
| 'LOCAL_MODEL_HOST': '127.0.0.1', | ||
| 'LOCAL_MODEL_PORT': '11636', | ||
| 'LOCAL_MODEL_PROTOCOL': "http" | ||
| 'LOCAL_MODEL_PROTOCOL': "http", | ||
| 'LOCAL_MODEL_HOST_WORKER': 1 | ||
|
|
||
| } | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code snippet appears to be a section of a configuration dictionary class defined in Python. Here is a brief review for any potential issues:
Suggested corrections: @@ -93,7 +93,8 @@
'SANDBOX': False,
'LOCAL_MODEL_HOST': '127.0.0.1',
'LOCAL_MODEL_PORT': '11636',
- 'LOCAL_MODEL_PROTOCOL': "http"
+ 'LOCAL_MODEL_PROTOCOL': "http",
+ 'LOCAL_MODEL_HOST_WORKER': 4 # Assuming you want four workersThese changes address the identified issue and make the code more readable and correct. If there are further optimizations needed, additional context about what these configurations represent (e.g., database settings, API endpoints) would be helpful. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided Gunicorn command line is mostly correct, but there are a few minor improvements and clarifications that could be made:
Worker Configuration: The
workersetting should be more robust. Instead of hardcoding it to 1, you can use a variable that checks if the configuration has been set; otherwise, default it to 1. This ensures that the application works even if the configuration file does not specify this option.Security Considerations: Ensure that paths in the environment variables like
LOCAL_MODEL_HOST,LOCAL_MODEL_PORT, etc., are properly sanitized to avoid security vulnerabilities such as injection attacks if they come from user input.Logging Format: Double-check the format string for logging (
--access-logformat) to ensure it correctly reflects what information needs to be logged by your application. You might want to adjust it based on your specific requirements.Here’s an improved version of the command with these considerations:
Make sure to replace
'smartdoc.wsgi'with the actual path to your WSGI module if different, depending on how your Flask app is structured.