jmikedupont2 / https-lablab.ai-event-llama-2-hackathon-with-clarifai-introspector

https://lablab.ai/event/llama-2-hackathon-with-clarifai/introspector
MIT License
1 stars 3 forks source link

Workflow #1

Open jmikedupont2 opened 1 year ago

jmikedupont2 commented 1 year ago

Creating a Clarifai workflow that embodies the concept you've described would involve a series of steps that capture the essence of your idea. While I can't directly create a Clarifai workflow in this text-based interface, I can provide you with an outline of the steps you could follow to design the workflow:

  1. Data Ingestion:

    • Collect the relevant data, text, or information that represents your concept.
    • Prepare the data in a structured format suitable for Clarifai's data input.
  2. Data Transformation:

    • Develop a script or code to transform the data into different representations, such as mathematical equations, programming languages, and more.
  3. Dimensionality Transformation:

    • Create a set of tasks that represent the iterative process of dimensionality transformation.
    • Each task should take the previous representation and transform it into a new dimension or representation.
  4. Harmonization and Convergence:

    • Design tasks that symbolize the harmonization of various dimensions or representations.
    • Use transformations, combinations, or other operations that bring the dimensions closer together.
  5. Unity and Synthesis:

    • Construct tasks that represent the ultimate unity and synthesis you've described.
    • This could involve combining representations, finding commonalities, or generating a symbolic output.
  6. Visualization and Insight:

    • If possible, add tasks that visualize the output or provide insights into the process.
    • Visualization could help you understand the convergence and harmonization visually.
  7. Output and Analysis:

    • Define the final output of the workflow, which could be a summary, insight, or data representation.
    • Analyze the output to validate whether it aligns with your original concept.

Remember that designing a Clarifai workflow involves creating a sequence of tasks using the Clarifai API or web interface. Each task will have inputs, processing steps, and outputs. You can use Python to interact with the Clarifai API and create these tasks programmatically.

Please note that the specific tasks and transformation details will depend on the nature of your original idea and how you want to represent each step within the Clarifai framework. You might also want to consider seeking assistance from someone familiar with the Clarifai API to help you implement your workflow effectively.

jmikedupont2 commented 1 year ago

Okay, so let's do a minimal viable product for this workflow that will basically take, we have the globals that we've extracted in Python, and I've sent them to clarify. We have redacted all of the keys from the memory, so there's no keys exposed. And now, basically, I've loaded this in, and we're going to associate with a workflow, and that workflow, we're going to have it compare all of the items with each other. So we're going to pair up all the items in an 8th-dimensional Cartesian join, and we're going to relate them all to each other.

jmikedupont2 commented 1 year ago

Here is one approach to creating a rewrite rule from the wiki page content to a workflow:

  1. Extract the key steps from the wiki page:
  1. Define workflow tasks to represent each step:
  1. Create a workflow definition:
workflow:
  - AddStarTask
  - RollDiceTask: {dimensions: 1}
  - AddPersonaTask
  - RollDiceTask: {dimensions: 2}  
  - AddSymbolTasks: {symbols: [shield, book, dancer, music, comedy, script]}
  - RollDiceTask: {dimensions: 3}
  - PermuteTasks: {depth: 1} 
  - RollDiceTask: {dimensions: 4}
  - AddSymbolTasks: {symbols: [element]}
  - RollDiceTask: {dimensions: 5}
  1. Connect workflow to wiki data:

This maps the key conceptual steps into an executable workflow definition. The wiki lines can be parsed and input into the workflow, generating an output that transforms the conceptual instructions into a programmatic process. Let me know if you would like me to clarify or expand on any part of this proposed rewrite rule.

abaybektursun commented 1 year ago

@jmikedupont2 Does Clarifai provide dev environment for building out a custom LLaMA 2 model? I wanna use libs likeaccelerate, bitsandbytes? Or can we deploy docker images? I want to:

  1. Fine-tune and customize LLama including adjusting its layers
  2. Quantiaze and compress it
  3. Deploy it to streaming API
jmikedupont2 commented 1 year ago

I would like to tell you about me new introspector project software that I am using to bootstrap my clarifi hackathon. @everyone I wanted to share an update on our Llama 2 hackathon project design process. We're documenting and tracking our project workflow and technical design in this GitHub issue:

https://github.com/jmikedupont2/https-lablab.ai-event-llama-2-hackathon-with-clarifai-introspector/issues/1

This issue thread will be used to outline our overall workflow, sketch concepts, track tasks, and get feedback. We'll be posting our user stories, wireframes, data models, and other key design docs here as we iterate.

Please feel free to review the issue and add any comments or suggestions! We want this to be collaborative. Let's use this issue as a central place to organize the project design as we build out the Llama 2 hackathon submission. Tagged relevant folks below who may want to follow along.

We're excited to take this community-driven approach to keep everything open and transparent as we progress. Please subscribe and contribute however you can!

jmikedupont2 commented 1 year ago

What are the memory reqs? It appears it can be squeezed onto my server with 12gb https://github.com/huggingface/text-generation-inference/issues/757

jmikedupont2 commented 1 year ago

Here are some key steps I would take to translate the Clarifai Help Center documentation on models and workflows into code for an automated workflow:

  1. Extract the key concepts and tasks described in the text into a list:

    • Creating workflows with model IDs and versions
    • Making predictions using a workflow
    • Getting, updating, and deleting workflows
    • Chaining models into an end-to-end workflow
  2. Map each concept/task to a module or function:

    • create_workflow(): Takes model IDs and versions, returns workflow object
    • predict_workflow(): Takes workflow ID and inputs, returns predictions
    • get_workflows(): Returns list of workflows
    • update_workflow(): Patches workflow with new models
    • delete_workflow(): Deletes a workflow
  3. Define the parameters needed for each function based on the docs:

    • Model IDs, version IDs, workflow IDs, user/app IDs, inputs
    • Action types like "overwrite", "remove" for updates
  4. Create skeleton code for the modules and functions

    • Focus on the signatures, inputs/outputs
    • Add TODOs for logic implementation
  5. Implement utils like authentication, error handling

    • Wrap Clarifai API requests
    • Handle errors and status codes
  6. Build out the function logic referencing the docs

    • Translate textual instructions into code
    • Call Clarifai API endpoints for each action
  7. Test the functions with sample data

    • Validate outputs match expected results
  8. Connect into an end-to-end workflow script

    • Call functions in sequence, passing outputs to inputs
    • Orchestrate the workflow as described

This gives a good starter workflow covering the key concepts that can be refined and built upon incrementally based on the docs. Let me know if any part needs more clarification!

jmikedupont2 commented 1 year ago

Got it, it sounds like you're looking to create a minimal viable product (MVP) of a workflow that takes the extracted global data from Python, redacts sensitive information, associates it with a Clarifai workflow, and then performs a pairwise comparison of the items within an 8th-dimensional Cartesian join. This is an interesting and complex task involving data processing, redaction, and comparison.

To implement this, you would need to:

  1. Ensure the extracted Python global data is properly formatted and redacted.
  2. Create or modify the Clarifai workflow to accept the formatted data.
  3. Develop a process to perform the pairwise comparison within an 8th-dimensional Cartesian join. This might involve creating combinations of the data items and running comparisons.
  4. Determine how the comparison results will be used or displayed.

Since this is a unique and complex task, it might require custom coding and integration with the Clarifai platform. Additionally, performance considerations should be kept in mind, especially if dealing with a large number of data items.

If you're looking for assistance with specific parts of this process, feel free to provide more details, and I'll be happy to help guide you further.

jmikedupont2 commented 1 year ago

Certainly, I can help you outline the structure of the Python code for generating the workflow with increasing levels of reviews. While I can provide you with the foundational structure and logic, please note that implementing the exact functionality of Clarifai's API and your specific use case would require further integration and testing. Here's a conceptual outline of how the code might look:

class Muse:
    def __init__(self, name):
        self.name = name
        self.reviewed_articles = []

    def review_article(self, article):
        # Logic to review the article and provide feedback
        # Store the reviewed article in the Muse's reviewed_articles list

class Workflow:
    def __init__(self, muses):
        self.muses = muses

    def add_review_level(self, article):
        # Add a new review level to the workflow
        new_level_muses = []
        for muse in self.muses:
            new_muse = Muse(muse.name)
            new_muse.reviewed_articles = muse.reviewed_articles.copy()
            new_level_muses.append(new_muse)

        for muse in self.muses:
            muse.review_article(article)

        self.muses.extend(new_level_muses)

def generate_workflow(initial_muses, num_levels):
    muses = [Muse(name) for name in initial_muses]
    workflow = Workflow(muses)
    article = "Initial article text."

    for level in range(num_levels):
        workflow.add_review_level(article)
        print(f"Review Level {level + 1}:")
        for muse in workflow.muses:
            print(f"{muse.name}: {muse.reviewed_articles[-1]}")

if __name__ == "__main__":
    initial_muses = ["Calliope", "Clio", "Euterpe", "Polyhymnia"]
    num_levels = 3  # You can adjust the number of levels as needed
    generate_workflow(initial_muses, num_levels)

This code outlines a simple simulation of the workflow generation and review process. Each Muse reviews the article at each level, and the workflow adds a new level of reviews while preserving the previous ones. This is just a starting point, and you can build upon it by integrating Clarifai's API and customizing the review logic to match your requirements.

Keep in mind that the above code is illustrative and might need adjustments based on the specifics of your application and the Clarifai API's functionality.

jmikedupont2 commented 1 year ago

Bing I can help you with the Python code for generating the workflow with increasing levels of reviews. Here's a conceptual outline of how the code might look:

class Muse:
    def __init__(self, name):
        self.name = name
        self.reviewed_articles = []

    def review_article(self, article):
        # Logic to review the article and provide feedback
        # Store the reviewed article in the Muse's reviewed_articles list

class Workflow:
    def __init__(self, muses):
        self.muses = muses

    def add_review_level(self, article):
        # Add a new review level to the workflow
        new_level_muses = []
        for muse in self.muses:
            new_muse = Muse(muse.name)
            new_muse.reviewed_articles = muse.reviewed_articles.copy()
            new_level_muses.append(new_muse)

        for muse in self.muses:
            muse.review_article(article)

        self.muses.extend(new_level_muses)

def generate_workflow(initial_muses, num_levels):
    muses = [Muse(name) for name in initial_muses]
    workflow = Workflow(muses)
    article = "Initial article text."

    for level in range(num_levels):
        workflow.add_review_level(article)
        print(f"Review Level {level + 1}:")
        for muse in workflow.muses:
            print(f"{muse.name}: {muse.reviewed_articles[-1]}")

if __name__ == "__main__":
    initial_muses = ["Calliope", "Clio", "Euterpe", "Polyhymnia"]
    num_levels = 3  # You can adjust the number of levels as needed
    generate_workflow(initial_muses, num_levels)

This code outlines a simple simulation of the workflow generation and review process. Each Muse reviews the article at each level, and the workflow adds a new level of reviews while preserving the previous ones. The Muse class represents a reviewer and has an attribute reviewed_articles that stores all articles reviewed by that Muse. The Workflow class represents a collection of Muses and has an attribute muses that stores all Muses. The add_review_level method adds a new level of reviews to the workflow by creating copies of all existing Muses and adding them to the workflow. Then, it calls the review_article method on each existing Muse to review the article at that level. Finally, it extends the list of Muses with the newly created ones. The generate_workflow function creates a list of Muses based on the input parameter initial_muses. It then creates a new instance of Workflow with these Muses and an initial article text. It then adds a new level of reviews to the workflow for each value in range(num_levels), printing out each reviewer's name and their reviewed articles at each level.

Please note that this is just a conceptual outline and not a complete implementation. You would need to integrate Clarifai's API and modify this code to suit your specific use case.

Source: Conversation with Bing, 8/25/2023 (1) GitHub - sartography/SpiffWorkflow: A powerful workflow engine .... https://github.com/sartography/SpiffWorkflow. (2) Python automation: 9 scripts to automate critical workflows. https://zapier.com/blog/python-automation/. (3) Top 15 Python Workflow engine Projects (Aug 2023) - LibHunt. https://www.libhunt.com/l/python/topic/workflow-engine. (4) undefined. https://discord.gg/BYHcc7PpUC.

jmikedupont2 commented 1 year ago

Thank you for sharing the updated information on this thread. Based on the new comments and details provided:

Overall, the additional code samples, use case details, and responses help paint a clearer picture of the direction. It seems like you are making good progress in drafting the workflows and thinking through how to leverage Clarifai's capabilities. Please feel free to provide any other updates as your hackathon project evolves. I'm happy to provide feedback on your design and implementation ideas.

jmikedupont2 commented 1 year ago

Implementing Our Harmonic Review Workflow in Python with Clarifai

Objective:

As a team, our goal is to create a Python workflow using Clarifai that facilitates a 3-level harmonic review process on a given dataset. We will construct this workflow to intelligently compare objects in groups of 3, leveraging prior review outputs to enhance the analysis at each successive level.

Requirements:

Success Metrics:

Required Resources:

Feel free to provide any clarification or suggest additional requirements that will enhance the workflow implementation task. We're dedicated to fine-tuning the incremental levels, optimizing the reuse logic, and ensuring a seamless integration with the Clarifai platform. Let's work together to make this project a success!