forked from FlagAI-Open/FlagAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ftgreat <[email protected]>
- Loading branch information
Showing
26 changed files
with
7,477 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright © 2022 BAAI. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License") | ||
import sys;sys.path.append("/home/yanzhaodong/FlagAI") | ||
import torch | ||
from flagai.auto_model.auto_loader import AutoLoader | ||
from flagai.model.predictor.predictor import Predictor | ||
|
||
# Initialize | ||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | ||
|
||
loader = AutoLoader(task_name="text2img", #contrastive learning | ||
model_name="AltDiffusion-m18", | ||
model_dir="./checkpoints", | ||
use_fp16=False) | ||
# loader = AutoLoader(task_name="text2img", #contrastive learning | ||
# model_name="AltDiffusion-m18") | ||
model = loader.get_model() | ||
# for name, param in model.named_parameters(): | ||
# if name.startswith("cond_stage_model"): | ||
# print(name) | ||
import pdb;pdb.set_trace() | ||
# model.eval() | ||
# model.to(device) | ||
# predictor = Predictor(model) | ||
# predictor.predict_generate_images_m18( | ||
# "Anime portrait of natalie portman as an anime girl by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, and sakimichan, trending on artstation" | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.