11using System . Collections . Generic ;
22using System . IO ;
3+ using System . Linq ;
34using System . Text . Json . Serialization ;
45using TensorStack . Common . Common ;
56using TensorStack . Python . Common ;
@@ -20,6 +21,8 @@ public class DiffusionModel : BaseModel
2021 public string Variant { get ; set ; }
2122 public ModelSourceType Source { get ; set ; }
2223 public bool IsDefault { get ; set ; }
24+ public bool IsGated { get ; set ; }
25+ public string Link { get ; set ; }
2326 public MemoryProfile [ ] MemoryProfile { get ; set ; }
2427 public DataType BaseType { get ; set ; }
2528 public ProcessType [ ] ProcessTypes { get ; set ; }
@@ -46,17 +49,18 @@ public void Initialize(string modelDirectory)
4649 IsValid = Directory . Exists ( System . IO . Path . Combine ( modelDirectory , Utils . GetHuggingFaceCacheId ( Path ) ) ) ;
4750 else if ( Source == ModelSourceType . SingleFile )
4851 {
49- IsValid = Checkpoint is not null && File . Exists ( Checkpoint . Checkpoint ) ;
52+ IsValid = Checkpoint is not null && Utils . IsCheckpointInstalled ( modelDirectory , Checkpoint . Checkpoint ) ;
5053 }
5154 else if ( Source == ModelSourceType . Checkpoint )
5255 {
5356 IsValid = Checkpoint is not null
54- && Utils . TryParseHuggingFaceRepo ( Path , out _ )
55- && ( string . IsNullOrEmpty ( Checkpoint . VaeCheckpoint ) || File . Exists ( Checkpoint . VaeCheckpoint ) )
56- && ( string . IsNullOrEmpty ( Checkpoint . ModelCheckpoint ) || File . Exists ( Checkpoint . ModelCheckpoint ) )
57- && ( string . IsNullOrEmpty ( Checkpoint . TextEncoderCheckpoint ) || File . Exists ( Checkpoint . TextEncoderCheckpoint ) ) ;
57+ && Utils . TryParseHuggingFaceRepo ( Path , out _ )
58+ && ( string . IsNullOrEmpty ( Checkpoint . VaeCheckpoint ) || Utils . IsCheckpointInstalled ( modelDirectory , Checkpoint . VaeCheckpoint ) )
59+ && ( string . IsNullOrEmpty ( Checkpoint . ModelCheckpoint ) || Utils . IsCheckpointInstalled ( modelDirectory , Checkpoint . ModelCheckpoint ) )
60+ && ( string . IsNullOrEmpty ( Checkpoint . TextEncoderCheckpoint ) || Utils . IsCheckpointInstalled ( modelDirectory , Checkpoint . TextEncoderCheckpoint ) ) ;
5861 }
5962 }
63+
6064 }
6165
6266 public sealed class MemoryProfile : BaseModel
0 commit comments