Use the generate config sampler instead of the undefined train_config in GenerateProcess#936
Open
rajakshay wants to merge 1 commit into
Open
Conversation
… in GenerateProcess
The sampler-building branch in GenerateProcess.__init__ referenced
`self.train_config.noise_scheduler`, but GenerateProcess never defines
`self.train_config` (only training processes do). Running a `generate`
job that hits this branch crashes at construction:
AttributeError: 'GenerateProcess' object has no attribute 'train_config'
Use the sampler from `self.generate_config`, which is already built
earlier in the same __init__. This branch currently always crashes, so
no working path is affected.
Author
Reproduction (no models or data, CPU-only)
repro.pyimport importlib
from collections import OrderedDict
# import_module returns the real submodule even though jobs.process re-exports the class
GP = importlib.import_module("jobs.process.GenerateProcess")
class DummyModel: # no get_train_scheduler -> forces the sampler else-branch
def __init__(self, *a, **k):
pass
GP.get_model_class = lambda cfg: DummyModel # no weights loaded
class FakeJob:
name = "repro"
meta = OrderedDict()
device = "cpu"
config = OrderedDict({
"output_folder": "/tmp/repro_out",
"model": OrderedDict({"name_or_path": "stub", "is_flux": True}),
"generate": OrderedDict({"prompts": ["a photo"], "sampler": "ddpm"}),
"dtype": "float16",
})
try:
GP.GenerateProcess(0, FakeJob(), config)
print("PASSED: GenerateProcess constructed; sampler built from generate_config.sampler")
except AttributeError as e:
print("REPRODUCED AttributeError:", str(e))
except Exception as e:
print("OTHER:", type(e).__name__, "-", str(e).splitlines()[0])Result: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In
GenerateProcess.__init__(jobs/process/GenerateProcess.py), the sampler-building branch referencesself.train_config.noise_scheduler, butGenerateProcessnever setsself.train_config(only training processes do).Why it breaks
Running a
generatejob that reaches this branch crashes at construction:Fix
Use
self.generate_config.sampler, which is already built earlier in the same__init__.GenerateConfigdefinessampler(default'ddpm'), which is exactly whatget_sampler(...)expects.Note on the previous attempt (#498)
This revives the fix reported in #416 and attempted in #498 (closed for inactivity). It intentionally uses
generate_config.samplerrather thangenerate_config.noise_scheduler(as in #498):GenerateConfighas asamplerattribute but nonoise_schedulerattribute, so.sampleractually resolves the crash instead of moving it to a differentAttributeError.Regression safety
This branch currently always crashes, so no working path is affected.
Validation
generatejob crashes at init with theAttributeErrorabove.Refs #416. Supersedes the approach in #498.