redkits commited on
Commit
4e63a35
·
verified ·
1 Parent(s): 1a9fc74

Upload server.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. server.py +23 -4
server.py CHANGED
@@ -58,6 +58,21 @@ def health():
58
  return jsonify({"status": "healthy"}), 200
59
  return jsonify({"status": "loading"}), 503
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  @app.route("/", methods=["POST"])
62
  def generate():
63
  try:
@@ -83,7 +98,8 @@ def generate():
83
  print(f"[video-long] Generating {num_frames} frames ({num_frames/fps:.1f}s): {prompt[:100]}", flush=True)
84
  print(f"[video-long] Params: {width}x{height}, steps={steps}, ar_step={ar_step}", flush=True)
85
 
86
- output = pipe(
 
87
  prompt=prompt,
88
  num_inference_steps=steps,
89
  height=height,
@@ -91,11 +107,14 @@ def generate():
91
  num_frames=num_frames,
92
  base_num_frames=base_num_frames,
93
  ar_step=ar_step,
94
- causal_block_size=causal_block_size,
95
  overlap_history=overlap_history,
96
  addnoise_condition=addnoise_condition,
97
- guidance_scale=guidance_scale,
98
- ).frames[0]
 
 
 
 
99
 
100
  # Write to temp file
101
  with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmp:
 
58
  return jsonify({"status": "healthy"}), 200
59
  return jsonify({"status": "loading"}), 503
60
 
61
+ @app.route("/debug", methods=["GET"])
62
+ def debug():
63
+ if pipe is None:
64
+ return jsonify({"status": "loading"}), 503
65
+ import inspect
66
+ sig = inspect.signature(pipe.__call__)
67
+ params = {}
68
+ for name, param in sig.parameters.items():
69
+ params[name] = str(param.default) if param.default != inspect.Parameter.empty else "required"
70
+ return jsonify({
71
+ "pipeline_class": type(pipe).__name__,
72
+ "parameters": params,
73
+ "device": str(pipe.device) if hasattr(pipe, 'device') else 'unknown',
74
+ })
75
+
76
  @app.route("/", methods=["POST"])
77
  def generate():
78
  try:
 
98
  print(f"[video-long] Generating {num_frames} frames ({num_frames/fps:.1f}s): {prompt[:100]}", flush=True)
99
  print(f"[video-long] Params: {width}x{height}, steps={steps}, ar_step={ar_step}", flush=True)
100
 
101
+ # Build kwargs - only pass causal_block_size when ar_step > 0
102
+ call_kwargs = dict(
103
  prompt=prompt,
104
  num_inference_steps=steps,
105
  height=height,
 
107
  num_frames=num_frames,
108
  base_num_frames=base_num_frames,
109
  ar_step=ar_step,
 
110
  overlap_history=overlap_history,
111
  addnoise_condition=addnoise_condition,
112
+ )
113
+ if ar_step > 0:
114
+ call_kwargs["causal_block_size"] = causal_block_size
115
+
116
+ print(f"[video-long] Pipeline call kwargs: {call_kwargs}", flush=True)
117
+ output = pipe(**call_kwargs).frames[0]
118
 
119
  # Write to temp file
120
  with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmp: