code: def test_textsynth():
      if "TEXTSYNTH_API_SECRET_KEY" not in os.environ:
          os.environ["TEXTSYNTH_API_SECRET_KEY"] = ""
      textsynth = models.get_model("textsynth").create_from_arg_string(
          "engine=gptj_6B"
      )
      (
          (ll_dog, ig_dog),
          (ll_cat, ig_cat),
          (_, ll_max_0),
          (_, ll_max_1),
          (_, ll_max_2),
          *vals,
      ) = textsynth.loglikelihood(LOGLIKELIHOOD_TEST_CASES)
  
      assert ll_dog > ll_cat
      assert not ig_cat
  
      assert ig_dog
      assert not ll_max_0
      assert not ll_max_1
      assert not ll_max_2
  
      # test empty context
      textsynth.loglikelihood([("", "test")])
  
      (gen,) = textsynth.greedy_until(
          [("The quick brown fox jumps over the lazy", [".", "\n"])]
      )
  
      assert gen == " dog"
  
      print([x[0] for x in vals])
  
      targets = [
          -17.90513712817,
          -41.83518912287,
          -33.82445643841,
          -2.377361565302,
          -99.53018069754,
          -243.5642283598,
          -528.6862613790,
          -17.90513712817,
          -5.041000672142,
      ]
  
      for (pred, _), tgt in zip(vals, targets):
          assert pred == pytest.approx(tgt, rel=1e-3)
  
file_path: lm-evaluation-harness/tests/test_models.py
imports: import hashlib
  import json
  import openai
  import os
  import pickle
  import pytest
  import unittest.mock
  import lm_eval.models
label_desc: Use image node_id 7 for calling a global function with example usage: test_textsynth() without return types