Downloads · 30 days
0
ki1killer/Xlinx-Chat-Dev-1
Xlinx-Chat-Dev-1 is a machine learning model from ki1killer. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
OmniModalLLM is a versatile and powerful multimodal language model designed to handle both text and image inputs, enabling sophisticated conversational AI applications similar to ChatGPT. Leveraging advanced architect…
Downloads · 30 days
0
Access
Public
Updated Oct 17, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py57.6 KB · 70%
From the Hugging Face model README
OmniModalLLM is a versatile and powerful multimodal language model designed to handle both text and image inputs, enabling sophisticated conversational AI applications similar to ChatGPT. Leveraging advanced architectures like Mixture of Experts (MoE) and Vector Quantized Variational Autoencoders (VQVAE), OmniModalLLM offers robust performance and adaptability across various tasks.
slowapi.git clone https://github.com/kirill670/OmniModalLLM.git
cd OmniModalLLM
It's recommended to use a virtual environment to manage dependencies.
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install --upgrade pip
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
pip install transformers datasets pillow fastapi uvicorn tiktoken einops tensorboard faiss-cpu slowapi
Note: If you're using a TPU or CPU, adjust the PyTorch installation accordingly.
OmniModalLLM is pre-configured to train on the Flickr30k and DailyDialog datasets. Ensure you have sufficient computational resources before initiating training.
python training_script.py
This command will:
Training Parameters:
The FastAPI server provides a /chat/ endpoint for interactive conversations. Once the training completes, the API server will be accessible at http://0.0.0.0:8000/chat/.
If you wish to run the API server without training, ensure the model is trained and load the saved checkpoint.
python api_server.py
This command will:
http://0.0.0.0:8000./chat/ endpoint for interactive chat./chat/Generates a response based on the provided chat messages.
Request Body:
{
"session_id": "optional-session-id",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
]
}
session_id (optional): Unique identifier to maintain conversation context across multiple requests. If not provided, a new session will be created.messages: List of message objects containing the role (user, assistant, or system) and the content.Response:
{
"session_id": "unique-session-id",
"message": {
"role": "assistant",
"content": "I'm a model designed to assist you. How can I help today?"
}
}
curlInitial Request (Start a New Session):
curl -X POST "http://localhost:8000/chat/" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}'
Response:
{
"session_id": "generated-session-id",
"message": {
"role": "assistant",
"content": "I'm doing well, thank you! How can I assist you today?"
}
}
Subsequent Request (Continue the Conversation):
curl -X POST "http://localhost:8000/chat/" \
-H "Content-Type: application/json" \
-d '{
"session_id": "existing-session-id",
"messages": [
{"role": "user", "content": "Can you tell me a joke?"}
]
}'
Response:
{
"session_id": "existing-session-id",
"message": {
"role": "assistant",
"content": "Sure! Why did the computer show up at work late? It had a hard drive!"
}
}
Create a New POST Request:
http://localhost:8000/chat/Set Headers:
Content-Type: application/jsonSet Body:
raw and JSON format.curl examples.Send the Request:
For a more interactive experience, consider creating a simple frontend using frameworks like React, Vue, or even plain HTML/CSS/JavaScript. This frontend can interact with the FastAPI backend via the /chat/ endpoint, allowing users to engage in conversations with the assistant through a web interface.
Contributions are welcome! Please follow these steps:
git checkout -b feature/YourFeature).git commit -m 'Add some feature').git push origin feature/YourFeature).Please ensure your code adheres to the project's coding standards and includes appropriate tests.
This project is licensed under the MIT License.
OmniModalLLM — это универсальная и мощная мультимодальная языковая модель, разработанная для обработки как текстовых, так и изображенческих данных. Она позволяет создавать сложные приложения для разговорного ИИ, аналогичные ChatGPT. Используя передовые архитектуры, такие как Mixture of Experts (MoE) и Vector Quantized Variational Autoencoders (VQVAE), OmniModalLLM обеспечивает высокую производительность и адаптивность для различных задач.
slowapi.git clone https://github.com/kirill670/OmniModalLLM.git
cd OmniModalLLM
Рекомендуется использовать виртуальное окружение для управления зависимостями.
python -m venv venv
source venv/bin/activate # В Windows: venv\Scripts\activate
pip install --upgrade pip
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
pip install transformers datasets pillow fastapi uvicorn tiktoken einops tensorboard faiss-cpu slowapi
Примечание: Если вы используете TPU или CPU, настройте установку PyTorch соответствующим образом.
OmniModalLLM преднастроена для обучения на датасетах Flickr30k и DailyDialog. Убедитесь, что у вас есть достаточные вычислительные ресурсы перед началом обучения.
python training_script.py
Эта команда выполнит следующие действия:
Параметры обучения:
Сервер FastAPI предоставляет эндпоинт /chat/ для интерактивных разговоров. После завершения обучения API-сервер будет доступен по адресу http://0.0.0.0:8000/chat/.
Если вы хотите запустить API-сервер без обучения, убедитесь, что модель обучена и загрузите сохраненный чекпоинт.
python api_server.py
Эта команда выполнит следующие действия:
http://0.0.0.0:8000./chat/ для интерактивного чата./chat/Генерирует ответ на основе предоставленных сообщений чата.
Тело запроса:
{
"session_id": "optional-session-id",
"messages": [
{
"role": "user",
"content": "Привет, как дела?"
}
]
}
session_id (опционально): Уникальный идентификатор для поддержания контекста разговора между несколькими запросами. Если не предоставлен, будет создана новая сессия.messages: Список объектов сообщений, содержащих роль (user, assistant или system) и содержимое.Ответ:
{
"session_id": "unique-session-id",
"message": {
"role": "assistant",
"content": "Я модель, созданная для помощи вам. Чем могу помочь сегодня?"
}
}
curlНачальный запрос (Создание новой сессии):
curl -X POST "http://localhost:8000/chat/" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Привет, как дела?"}
]
}'
Ответ:
{
"session_id": "generated-session-id",
"message": {
"role": "assistant",
"content": "Я делаю хорошо, спасибо! Чем могу помочь вам сегодня?"
}
}
Последующий запрос (Продолжение разговора):
curl -X POST "http://localhost:8000/chat/" \
-H "Content-Type: application/json" \
-d '{
"session_id": "existing-session-id",
"messages": [
{"role": "user", "content": "Расскажи анекдот."}
]
}'
Ответ:
{
"session_id": "existing-session-id",
"message": {
"role": "assistant",
"content": "Конечно! Почему компьютер опоздал на работу? Потому что у него был жесткий диск!"
}
}
Создайте новый POST-запрос:
http://localhost:8000/chat/Установите заголовки:
Content-Type: application/jsonУстановите тело запроса:
raw и формат JSON.curl.Отправьте запрос:
Для более интерактивного опыта рассмотрите возможность создания простого фронтенда с использованием таких фреймворков, как React, Vue или даже простого HTML/CSS/JavaScript. Этот фронтенд может взаимодействовать с бэкендом FastAPI через эндпоинт /chat/, позволяя пользователям вести диалог с ассистентом через веб-интерфейс.
Вклады приветствуются! Пожалуйста, следуйте этим шагам:
git checkout -b feature/YourFeature).git commit -m 'Добавить некоторую функцию').git push origin feature/YourFeature).Пожалуйста, убедитесь, что ваш код соответствует стандартам кодирования проекта и включает соответствующие тесты.
Этот проект лицензирован под MIT License.
For further assistance, questions, or suggestions, please feel free to open an issue on the GitHub repository.
Dynamic Response Generation Loop in API Server:
generate_response_api function within the api_server.py script that handles token generation, temperature scaling, top-k and top-p sampling, and termination conditions.Updated Features Section:
Usage Instructions:
Concurrency and Thread Safety:
threading.Lock to prevent race conditions during concurrent access.Rate Limiting:
slowapi to protect the API from abuse, with configurable request limits.Error Handling Enhancements:
Device Compatibility:
CPU, GPU, or TPU) to prevent device mismatch errors during training and inference.Documentation Improvements:
curl and Postman to interact with the API.By incorporating these updates, the OmniModalLLM project now offers a more robust and flexible framework for developing advanced multimodal conversational AI applications.