Skip to content
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

feat(ui): artifact ref links #3500

Merged
merged 1 commit into from
Jan 28, 2025
Merged

feat(ui): artifact ref links #3500

merged 1 commit into from
Jan 28, 2025

Conversation

jamie-rasmussen
Copy link
Collaborator

@jamie-rasmussen jamie-rasmussen commented Jan 27, 2025

Description

Pulling frontend changes out of #2920 and updating them to resolve merge conflicts

Before:
Screenshot 2025-01-27 at 4 51 11 PM

After:

Screenshot 2025-01-27 at 4 51 53 PM

Testing

Now that the changes in #3484 have been deployed, these changes can be tested against the prod trace server backend. I used a tweaked version of the script from the original PR.

from typing import List
import weave

import wandb

# Configuration Constants
PROJECT = "2025-01-23_artref"
TEAM_ENTITY = "jamie-team"  # MAKE SURE THIS IS NOT A PERSONAL ENTITY
PERSONAL_ENTITY = "jamie-rasmussen" # Most likely your username
ORG_ENTITY = "wandb-jamie"  # Fetch this from the UI banner {BASE_URL}/orgs/wandb/registry/model

artifact_name = "test"

# log an empty personal entity artifact
run = wandb.init(project=PROJECT, entity=PERSONAL_ENTITY)
model_artifact = wandb.Artifact(name=artifact_name, type="model")
run.log_artifact(model_artifact).wait()
ARTIFACT = f"wandb-artifact:///{model_artifact.qualified_name}"
print(f"Logged personal entity artifact: {ARTIFACT}")

# link to model registry artifact
run.link_artifact(model_artifact, f"model-registry/{artifact_name}")
MODEL_REG_URL = f"wandb-artifact:///{PERSONAL_ENTITY}/model-registry/{artifact_name}:latest"
run.finish()

# Log a team entity artifact
run = wandb.init(project=PROJECT, entity=TEAM_ENTITY)
model_artifact = wandb.Artifact(name=artifact_name, type="model")
run.log_artifact(model_artifact).wait()
ARTIFACT = f"wandb-artifact:///{model_artifact.qualified_name}"
print(f"Logged team entity artifact: {ARTIFACT}")


# link to global registry
run.link_artifact(model_artifact, f"wandb-registry-model/{artifact_name}")
GLOBAL_REGISTRY_URL = (
    f"wandb-artifact:///{ORG_ENTITY}/wandb-registry-model/{artifact_name}:latest"
)
print(f"Linked team entity artifact to global registry: {GLOBAL_REGISTRY_URL}")
run.finish()


NON_EXISTENT_ARTIFACT = "wandb-artifact:///im-not-valid/im-not-real/testArtifact:v1"


class UnslothLoRAChatModel(weave.Model):
    """
    ChatModel class to store and version additional parameters beyond just the model name.
    Especially useful for fine-tuning scenarios.
    """

    model_registry: str
    wandb_registry_model: str
    regular_artifact: str
    invalid_artifact: str
    cm_temperature: float
    device: str

    @weave.op()
    def predict(self, query: List[str]) -> str:
        return "Berlin"


def main():
    # Instantiate the Chat Model
    new_chat_model = UnslothLoRAChatModel(
        name="UnslothLoRAChatModelRag",
        model_registry=MODEL_REG_URL,
        wandb_registry_model=GLOBAL_REGISTRY_URL,
        regular_artifact=ARTIFACT,
        invalid_artifact=NON_EXISTENT_ARTIFACT,
        cm_temperature=1.0,
        device="cpu",
    )
    print(new_chat_model)

    weave.init(f"{PERSONAL_ENTITY}/{PROJECT}")

    result = new_chat_model.predict(["What is the capital of Germany?"])
    print(result)


if __name__ == "__main__":
    main()

@circle-job-mirror
Copy link

circle-job-mirror bot commented Jan 27, 2025

@jamie-rasmussen jamie-rasmussen marked this pull request as ready for review January 28, 2025 04:44
@jamie-rasmussen jamie-rasmussen requested review from a team as code owners January 28, 2025 04:44
@jamie-rasmussen jamie-rasmussen merged commit a631bab into master Jan 28, 2025
126 checks passed
@jamie-rasmussen jamie-rasmussen deleted the jamie/artifact-refs branch January 28, 2025 23:50
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants